setName() public method

This method can set both the namespace and the name if you separate them by a colon (:) $command->setName('foo:bar');
public setName ( string $name ) : Command
$name string The command name
return Command The current instance
コード例 #1
0
ファイル: AbstractCommand.php プロジェクト: lulco/phoenix
 /**
  * @param string $name
  * @return AbstractCommand
  */
 public function setName($name)
 {
     if (!$this->getName()) {
         return parent::setName($name);
     }
     return $this;
 }
コード例 #2
0
ファイル: CommandWrapper.php プロジェクト: maslosoft/sitcom
 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'));
     }
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 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);
     }
 }
コード例 #6
0
 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.');
 }
コード例 #7
0
 /**
  * {@inheritdoc}
  */
 public function setName($name)
 {
     $this->decoratedCommand->setName($name);
     return $this;
 }
コード例 #8
0
ファイル: ListMessage.php プロジェクト: baleen/cli
 /**
  * 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)');
 }
コード例 #9
0
ファイル: DumpCommand.php プロジェクト: liutec/neo4jtransfer
 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);
 }
コード例 #10
0
 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);
 }
コード例 #11
0
 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');
 }
コード例 #12
0
ファイル: WrappedCommand.php プロジェクト: lolautruche/ezsh
 public function setName($name)
 {
     parent::setName($name);
     return $this->innerCommand->setName($name);
 }
コード例 #13
0
ファイル: StatusMessage.php プロジェクト: baleen/cli
 /**
  * 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.');
 }
コード例 #14
0
ファイル: LatestMessage.php プロジェクト: baleen/cli
 /**
  * @inheritdoc
  */
 public static function configure(Command $command)
 {
     $command->setName('storage:latest')->setDescription('Outputs the ID of the latest migrated version.');
 }
コード例 #15
0
ファイル: UpdateBadges.php プロジェクト: benestar/benebot
 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');
 }
コード例 #16
0
ファイル: InitMessage.php プロジェクト: baleen/cli
 /**
  * @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.');
 }
コード例 #17
0
ファイル: CreateMessage.php プロジェクト: baleen/cli
 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.');
 }
コード例 #18
0
ファイル: LatestMessage.php プロジェクト: baleen/cli
 /**
  * configure.
  *
  * @param Command $command
  */
 public static function configure(Command $command)
 {
     $command->setName('migrations:latest')->setDescription('Prints the version ID of the latest available migration.');
 }