protected function interact(InputInterface $input, OutputInterface $output)
 {
     $output->writeln($this->app['app.signature']);
     $slug = $input->getArgument('slug');
     $edition = $input->getArgument('edition');
     if (null != $slug && '' != $slug && null != $edition && '' != $edition) {
         return;
     }
     $output->writeln(array('', ' Welcome to the <comment>easybook</comment> interactive book publisher', ''));
     $dialog = $this->getHelperSet()->get('dialog');
     // check `slug` argument
     $slug = $input->getArgument('slug') ?: $dialog->askAndValidate($output, array(" Please, type the <info>slug</info> of the book (e.g. <comment>the-origin-of-species</comment>)\n", " > "), function ($slug) {
         return Validators::validateBookSlug($slug);
     });
     $input->setArgument('slug', $slug);
     // check `edition` argument
     $edition = $input->getArgument('edition') ?: $dialog->askAndValidate($output, array(" Please, type the name of the <info>edition</info> to be published (e.g. <comment>web</comment>)\n", " > "), function ($edition) {
         return Validators::validateNonEmptyString('edition', $edition);
     });
     $input->setArgument('edition', $edition);
 }
示例#2
0
 protected function interact(InputInterface $input, OutputInterface $output)
 {
     $output->writeln($this->app['app.signature']);
     $title = $input->getArgument('title');
     if (null != $title && '' != $title) {
         return;
     }
     $output->writeln(array('', ' Welcome to the <comment>easybook</comment> interactive book generator', ''));
     $dialog = $this->getHelperSet()->get('dialog');
     // check `title` argument
     $title = $input->getArgument('title') ?: $dialog->askAndValidate($output, "\n Please, type the <info>title</info> of the book" . " (e.g. <comment>The Origin of Species</comment>)" . "\n > ", function ($title) {
         return Validators::validateNonEmptyString('title', $title);
     });
     $input->setArgument('title', $title);
 }