/** * @param string $name * @return AbstractCommand */ public function setName($name) { if (!$this->getName()) { return parent::setName($name); } return $this; }
public function add(Command $command, $namespace = '') { if (strlen($namespace)) { $command->setName($namespace . ':' . $command->getName()); } $this->app->add($command); }
public function __construct(Command $singleCommand) { global $argv; $this->singleCommand = $singleCommand; // Use the command's name as the whole app's name $this->setName($singleCommand->getName()); // Then set the command's name to be the name of the script file // executed (as executed, regardless of symlinks, etc) - i.e. // whatever's set as $argv[0] - because this name ends up displayed in // the "Usage" line of the `--help` output. Though we use the executed // script's base name (i.e. none of the directories leading to it) // because including any parts of the directory path results in a // `--help` output that's very different to all native/standard // commands. // This will result in the "Usage" section displaying as: // my-command.php [options] [--] <arguments> // instead of showing the name of the command in place of // 'my-command.php', which is especially useful for single-command // apps, as the command name is never even referenced anywhere else! $commandName = isset($argv[0]) ? basename($argv[0]) : 'command.php'; $singleCommand->setName($commandName); parent::__construct(); $this->add($singleCommand); $this->setDefaultCommand($singleCommand->getName()); // If the command class has an 'APP_VERSION' constant defined, we use // that as the entire app's version, as this seems like a much more // sensible place to indicate the version than in the Application // constructor which is tucked away in a non-obvious place! $commandClass = get_class($singleCommand); if (defined($commandClass . '::APP_VERSION')) { $this->setVersion(constant($commandClass . '::APP_VERSION')); } }
public static function configureTransfer(BaseCommand $command, $name = 'transfer', $output = true) { $command->setName($name)->setDescription('Clone all nodes and relations from one Neo4j Server database into another.'); DumpCommand::configureSourceConnectionOptions($command); if ($output) { DumpCommand::configureOutputOptions($command); } ImportCommand::configureTargetConnectionOptions($command); }
public function integrate(Command $cmd) { $cmd->setName("metro:" . $cmd->getName()); $definition = $cmd->getDefinition(); $options = $definition->getOptions(); if (isset($options['short'])) { // remove -s shortcut (already used by Symfony's --shell option) $shortOption = $options['short']; $options['short'] = new InputOption('short', null, InputOption::VALUE_NONE, $shortOption->getDescription()); $definition->setOptions($options); } }
public static function configureImport(BaseCommand $command, $name = 'import') { $command->setName($name)->setDescription('Import all nodes and relations into a Neo4j Server database.'); static::configureTargetConnectionOptions($command); $command->addOption('input', null, InputArgument::OPTIONAL, 'Cypher input filename. If unspecified, will use STDIN. Set to last:[hostname] to use dump-[hostname]-[yyyyMMdd]-[hhmmss].cypher with the latest timestamp.'); }
/** * {@inheritdoc} */ public function setName($name) { $this->decoratedCommand->setName($name); return $this; }
/** * configure. * * @param Command $command */ public static function configure(Command $command) { $command->setName('migrations:list')->setDescription('Prints version IDs for all available migrations ordered incrementally.')->addOption('newest-first', null, InputOption::VALUE_NONE, 'Sort list in reverse order (newest first)'); }
public static function configureDump(BaseCommand $command, $name = 'dump') { $command->setName($name)->setDescription('Dump all nodes and relations from a Neo4j Server database.'); static::configureSourceConnectionOptions($command); static::configureOutputOptions($command); }
public function configure(Command $command) { $command->setName('task:purge-badge-page-props')->setDescription('Purge page props of pages to update badges')->addOption('chunk', null, InputOption::VALUE_OPTIONAL, 'The chunk size to fetch entities', 100); }
protected function configure() { parent::setName('generate:entity')->setDescription('Generates a Link entity from a table')->addArgument('entity', InputArgument::REQUIRED, 'The fully-qualified class name of the entity to ' . 'generate (use forward slashes instead of backslashes)')->addArgument('destination', InputArgument::OPTIONAL, 'The directory where the generated entity ' . 'should be saved', self::DEFAULT_PATH)->addOption('force', 'f', InputOption::VALUE_NONE, 'Overwrite any existing files'); }
public function setName($name) { parent::setName($name); return $this->innerCommand->setName($name); }
/** * Configures a console command by setting name, description, arguments, etc. * * @param Command $command */ public static function configure(Command $command) { $command->setName('config:status'); $command->setAliases(['status']); $command->setDescription('Shows the current migration status.'); }
/** * @inheritdoc */ public static function configure(Command $command) { $command->setName('storage:latest')->setDescription('Outputs the ID of the latest migrated version.'); }
public function configure(Command $command) { $command->setName('task:update-badges')->setDescription('Update badges based on Wikipedia categories on Wikidata')->addOption('badge', null, InputOption::VALUE_REQUIRED, 'The badge to set')->addOption('category', null, InputOption::VALUE_REQUIRED, 'The category to query')->addOption('bot', null, InputOption::VALUE_OPTIONAL, 'Mark edits as bot', true)->addOption('summary', null, InputOption::VALUE_OPTIONAL, 'Override the default edit summary', 'Bot: Adding badge [[$badgeId]] for site $wiki based on Category:$category'); }
/** * @inheritdoc */ public static function configure(Command $command) { $command->setName('config:init'); $command->setAliases(['init']); $command->setDescription('Initialises Baleen by creating a config file in the current directory.'); }
public static function configure(Command $command) { $command->setName('migrations:create')->setAliases(['create'])->setDescription('Creates a new migration file.')->addArgument('title', null, 'Adds a descriptive title for the migration file and class name', null)->addOption('namespace', null, InputOption::VALUE_OPTIONAL, 'Overrides the configured namespace', null)->addOption('editor-cmd', null, InputOption::VALUE_OPTIONAL, 'Open file with this command upon creation.'); }
/** * configure. * * @param Command $command */ public static function configure(Command $command) { $command->setName('migrations:latest')->setDescription('Prints the version ID of the latest available migration.'); }