/** * Writes the basic usage information of the command. * * @param Args $args The parsed args returned from {@link Cli::parseRaw()}. */ protected function writeUsage(Args $args) { if ($filename = $args->getMeta('filename')) { $schema = $this->getSchema($args->getCommand()); unset($schema[Cli::META]); echo static::bold("usage: ") . $filename; if ($this->hasCommand()) { if ($args->getCommand() && isset($this->commandSchemas[$args->getCommand()])) { echo ' ' . $args->getCommand(); } else { echo ' <command>'; } } if ($this->hasOptions($args->getCommand())) { echo " [<options>]"; } if ($hasArgs = $this->hasArgs($args->getCommand())) { echo $hasArgs === 2 ? " <args>" : " [<args>]"; } echo PHP_EOL . PHP_EOL; } }