/**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $name = $this->getListId('Select list to edit:');
     if (is_null($name)) {
         $this->abort();
     }
     $list = Todo::get($name);
     $title = $this->option('title');
     $subtitle = $this->option('subtitle');
     if (all_null($title, $subtitle)) {
         $this->info(sprintf("Editing '%s'", $name));
         $this->line('');
         $title = $this->ask("Enter list title (enter to skip)?");
         $subtitle = $this->ask("Enter list subtitle (enter to skip)?");
         $this->line('');
         if (all_null($title, $subtitle)) {
             $this->comment('Nothing changed. List not udpated.');
             return;
         }
     }
     if ($title) {
         $list->set('title', $title);
     }
     if ($subtitle) {
         $list->set('subtitle', $subtitle);
     }
     $list->save();
     $this->info(sprintf("List '%s' updated", $name));
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // Should we prompt for everything?
     $promptAll = all_null($this->argument('+name'), $this->argument('task-number'), $this->option('descript'), $this->option('action'));
     // Get list
     $name = $this->getListId('Select list with task to edit:');
     if (is_null($name)) {
         $this->abort();
     }
     $list = Todo::get($name);
     // Get task-number
     $taskNo = $this->getTaskNo($list, true, true, false);
     if (is_null($taskNo)) {
         $this->abort();
     }
     $currDescript = $list->taskGet($taskNo, 'description');
     $currAction = $list->taskGet($taskNo, 'isNextAction');
     // Prompt for description and next action
     if ($promptAll) {
         $currActionState = $currAction ? 'is' : 'is not';
         $this->line("Current description: {$currDescript}");
         $descript = $this->ask("New description (enter to skip)?");
         $this->line("Task {$currActionState} currently a Next Aciton.");
         $next = $this->ask("Is Next Action (enter skip, yes or no)?");
     } else {
         $descript = $this->option('descript');
         $next = $this->option('action');
     }
     $action = is_null($next) ? null : str2bool($next);
     if ((is_null($descript) || $descript == $currDescript) && (is_null($action) || $action == $currAction)) {
         $this->abort("Nothing changed");
     }
     // Make changes and save the list
     $task = $list->task($taskNo);
     if (!is_null($action)) {
         $task->setIsNextAction($action);
     }
     if (!is_null($descript)) {
         $task->setDescription($descript);
     }
     $list->save(true);
     $this->info("Task in {$name} updated to: " . (string) $task);
 }
 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     // Get options and arguments
     $name = $this->argument('+name');
     $title = $this->option('title');
     $subtitle = $this->option('subtitle');
     // Prompt for everything
     if (all_null($name, $title, $subtitle)) {
         if (!($name = $this->askForListId(false, true))) {
             $this->abort();
         }
         $title = $this->ask("Enter list title (enter to skip)?");
         $subtitle = $this->ask("Enter list subtitle (enter to skip)?");
     } else {
         if (is_null($name)) {
             $this->abort('Must specify +name if title or subtitle used');
         } else {
             if ($name[0] != '+') {
                 $this->abort('The list name must begin with a plus (+)');
             } else {
                 $name = substr($name, 1);
                 if ($this->repository->exists($name)) {
                     $this->abort("The list '{$name}' already exists");
                 }
             }
         }
     }
     // Create the list, defaulting title if needed
     $title = $title ?: ucfirst($name);
     $list = Todo::makeList($name, $title);
     // Set the subtitle if needed
     if ($subtitle) {
         $list->set('subtitle', $subtitle)->save();
     }
     $this->info("List '{$name}' successfully created");
 }
 public function testAllNull()
 {
     $this->assertTrue(all_null());
     $this->assertTrue(all_null(null));
     $this->assertTrue(all_null(null, null, null, null));
     $this->assertFalse(all_null(0));
     $this->assertFalse(all_null(null, null, '', null));
     $this->assertFalse(all_null(null, null, null, 33));
 }