### Table Formatting Example Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/Style/SymfonyStyle/output/output_18.txt Demonstrates how to create and display tables in the Symfony Console using the Table helper. This includes defining rows and columns with headers. ```php use Symfony\Component\Console\Helper\Table; use Symfony\Component\Console\Output\ConsoleOutput; $output = new ConsoleOutput(); $table = new Table($output); $table->setHeaders(['foo', 'bar']); $table->setRows([ ['this is a title', 'bar'], ['foo2', 'bar2'], ]); $table->render(); ``` -------------------------------- ### command1 Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/command_1.md This command is a basic example within the Symfony Console component. It has aliases and provides help text. ```APIDOC descriptor:command1 description: command 1 description aliases: [alias1, alias2] help: command 1 help ``` -------------------------------- ### Executing a Symfony Console Command Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_renderexception3.txt Shows a basic example of executing a custom console command named 'foo3:bar'. This represents a typical interaction with the Symfony Console component. ```php foo3:bar ``` -------------------------------- ### Symfony Console Command: descriptor:command1 Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/command_1.rst This entry describes the 'descriptor:command1' console command. It includes its primary description, usage examples, and any defined aliases. ```APIDOC descriptor:command1 ................... command 1 description Usage ^^^^^ - ``descriptor:command1`` - ``alias1`` - ``alias2`` command 1 help ``` -------------------------------- ### Defining Console Arguments and Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/input_argument_with_style.txt This snippet demonstrates how to define arguments and options for a Symfony console command. Arguments are required positional values, while options are optional key-value pairs. The example shows how to specify argument names, descriptions, and default values, as well as option names, descriptions, and whether they accept values. ```php use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Command\Command; class MyCommand extends Command { protected function configure() { $this ->setName('app:my-command') ->setDescription('An example command') ->addArgument( 'argument_name', InputArgument::REQUIRED, 'argument description' ) ->addOption( 'option_name', 'o', InputOption::VALUE_OPTIONAL, 'option description', 'default_value' ); } } ``` -------------------------------- ### Symfony Console Available Commands Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_mbstring.txt Lists the built-in and custom commands available within the Symfony Console application. This includes standard commands for help and listing other commands, as well as example custom commands. ```APIDOC Available commands: completion Dump the shell completion script help Display help for a command list List commands descriptor descriptor:åèä command åèä description ``` -------------------------------- ### Symfony Console Command Signature Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_renderexception2.txt Defines the signature for a console command, including options and arguments. This example shows a 'list' command with optional formatting and a namespace argument. ```APIDOC list [--raw] [--format FORMAT] [--short] [--] [] ``` -------------------------------- ### Define Console Arguments and Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/input_argument_with_default_inf_value.txt Demonstrates how to define arguments and options for Symfony Console commands. Arguments are required values, while options are optional flags that can modify command behavior. The example shows how to specify argument names, descriptions, and default values. ```php use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; protected function configure() { $this ->addArgument( 'name', InputArgument::REQUIRED, 'What is your name?' ) ->addOption( 'greeting', null, InputOption::VALUE_OPTIONAL, 'How to greet the user?', 'Hello' ); } ``` -------------------------------- ### Symfony Console Error Message Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_renderexception2.txt An example of an error message generated by the Symfony Console Component when an invalid option is provided to a command. ```APIDOC The "--foo" option does not exist. ``` -------------------------------- ### Basic Command Creation Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_gethelp.txt Demonstrates how to create a simple command using the Symfony Console Component. This involves defining the command's signature, description, and execution logic. ```PHP setDescription('Greets the user.') ->setHelp('This command greets the user by name.'); } protected function execute(InputInterface $input, OutputInterface $output) { $output->writeln('Hello World!'); return Command::SUCCESS; } } ``` -------------------------------- ### Symfony Console Global Commands Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_2.rst Documentation for the global commands 'help' and 'list' in the Symfony Console component. Includes usage, arguments, and options for displaying command help and listing available commands. ```APIDOC help Display help for a command Usage: help [--format FORMAT] [--raw] [--] [] Arguments: command_name: The name of the command to get help for. Options: --format FORMAT: The output format (txt, xml, json, or md) (required). --raw: To output raw command help. Examples: %%PHP_SELF%% help list %%PHP_SELF%% help --format=xml list list List commands Usage: list [--raw] [--format FORMAT] [--short] [--] [] Arguments: namespace: The namespace to list commands for. Options: --raw: To output raw command list. --format FORMAT: The output format (txt, xml, json, or md) (required). --short: To skip describing commands' arguments. Examples: %%PHP_SELF%% list %%PHP_SELF%% list test %%PHP_SELF%% list --format=xml %%PHP_SELF%% list --raw ``` -------------------------------- ### Command 1 Documentation Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/command_1.txt Details for command 1, including its description, usage aliases, and help text. ```APIDOC command 1 description Usage: descriptor:command1 alias1 alias2 Help: command 1 help ``` -------------------------------- ### ApplicationTest Error Message Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_renderexception_doublewidth1.txt This snippet shows an example of an error message encountered during testing of the Symfony Console Application. It highlights a specific error scenario in ApplicationTest.php. ```php Project: /symfony/console Content: In ApplicationTest.php line %d: エラーメッセージ foo ``` -------------------------------- ### descriptor:command1 Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_2.md Documentation for 'command1' within the 'descriptor' namespace. Includes usage, description, and available options. ```APIDOC descriptor:command1 command 1 description Usage: descriptor:command1 alias1 alias2 command 1 help Options: --help|-h Display help for the given command. When no command is given display help for the list command. --silent Do not output any message. --quiet|-q Only errors are displayed. All other output is suppressed. --verbose|-v|-vv|-vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug. --version|-V Display this application version. --ansi|--no-ansi Force (or disable --no-ansi) ANSI output. --no-interaction|-n Do not ask any interactive question. ``` -------------------------------- ### Symfony Console Help Command Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_2.md Displays help for a given command. Supports different output formats and raw output. ```APIDOC help [--format FORMAT] [--raw] [--] [] Display help for a command Arguments: command_name The command name (default: 'help') Options: --format FORMAT The output format (txt, xml, json, or md) (required) --raw To output raw command help -h, --help Display help for the given command. When no command is given display help for the list command --silent Do not output any message -q, --quiet Only errors are displayed. All other output is suppressed -v, -vv, -vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug -V, --version Display this application version --ansi, --no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question ``` -------------------------------- ### Symfony Console Available Commands Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_run1.txt Lists the commands available in the Symfony Console Tool. These commands provide functionalities such as displaying help, listing other commands, and managing shell completion. ```APIDOC Available commands: completion Dump the shell completion script help Display help for a command list List commands ``` -------------------------------- ### descriptor:command2 Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_2.md Documentation for 'command2' within the 'descriptor' namespace. Details usage, arguments, and options. ```APIDOC descriptor:command2 [-o|--option_name] [--] command 2 description Usage: descriptor:command2 [-o|--option_name] [--] descriptor:command2 -o|--option_name descriptor:command2 Arguments: argument_name Options: -o|--option_name --help|-h Display help for the given command. When no command is given display help for the list command. --silent Do not output any message. --quiet|-q Only errors are displayed. All other output is suppressed. --verbose|-v|-vv|-vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug. --version|-V Display this application version. --ansi|--no-ansi Force (or disable --no-ansi) ANSI output. --no-interaction|-n Do not ask any interactive question. ``` -------------------------------- ### Chained Exception Display in Symfony Console Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_renderexception3decorated.txt This snippet illustrates how Symfony's Console component displays chained exceptions. It shows the output format for nested exceptions, including custom messages and HTML tags within the exception context. The example demonstrates a chain of three exceptions, with the innermost exception containing HTML. ```php comment'); // Exception 2 // throw new Exception('Second exception comment', 0, $exception3); // Exception 1 // throw new Exception('First exception

this is html

', 0, $exception2); // Command execution output would typically show: // In Foo3Command.php line 26: // Third exception comment // In Foo3Command.php line 23: // Second exception comment // In Foo3Command.php line 21: // First exception this is html // Command execution example: // $ php app/console foo3:bar ``` -------------------------------- ### Symfony Console Tool Usage and Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_1.txt This section details the general usage pattern for the Symfony Console Tool and its available command-line options. It covers how to specify commands, arguments, and options to control the tool's behavior, such as displaying help, managing output verbosity, and handling user interaction. ```APIDOC Console Tool: Usage: command [options] [arguments] Options: -h, --help Display help for the given command. When no command is given display help for the list command --silent Do not output any message -q, --quiet Only errors are displayed. All other output is suppressed -V, --version Display this application version --ansi|--no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands: completion Dump the shell completion script help Display help for a command list List commands ``` -------------------------------- ### descriptor:åèä Command Documentation Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_mbstring.md Detailed documentation for the 'descriptor:åèä' command, including its usage, arguments, and options. ```APIDOC command åèä description ### Usage * `descriptor:åèä [-o|--option_åèä] [--] ` * `descriptor:åèä -o|--option_name ` * `descriptor:åèä ` command åèä help ### Arguments #### `argument_åèä` Description: The argument for the descriptor command. Is required: yes Is array: no Default: `NULL` ### Options #### `--option_åèä|-o` Description: A specific option for the descriptor command. Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` #### `--help|-h` Description: Display help for the given command. When no command is given display help for the list command Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` #### `--silent` Description: Do not output any message Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` #### `--quiet|-q` Description: Only errors are displayed. All other output is suppressed Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` #### `--verbose|-v|-vv|-vvv` Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` #### `--version|-V` Description: Display this application version Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` #### `--ansi|--no-ansi` Description: Force (or disable --no-ansi) ANSI output Accept value: no Is value required: no Is multiple: no Is negatable: yes Default: `NULL` #### `--no-interaction|-n` Description: Do not ask any interactive question Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` ``` -------------------------------- ### Symfony Console Tool Usage and Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_run1.txt Describes the general usage pattern for the Symfony Console Tool and lists its common global options. These options control aspects like help display, verbosity, and interaction. ```APIDOC Usage: command [options] [arguments] Options: -h, --help Display help for the given command. When no command is given display help for the list command --silent Do not output any message -q, --quiet Only errors are displayed. All other output is suppressed -V, --version Display this application version --ansi|--no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug ``` -------------------------------- ### Symfony Console Global Commands Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_mbstring.rst Documentation for global commands in the Symfony Console component, including 'help' and 'list'. These commands are essential for navigating and understanding the available functionalities within the console application. ```APIDOC help: description: Display help for a command usage: "help [--format FORMAT] [--raw] [--] []" arguments: command_name: The name of the command to display help for. options: --format: description: The output format (txt, xml, json, or md) accept_value: yes is_value_required: yes is_multiple: no is_negatable: no default: 'txt' --raw: description: To output raw command help accept_value: no is_value_required: no is_multiple: no is_negatable: no default: false list: description: List commands usage: "list [--raw] [--format FORMAT] [--short] [--] []" arguments: namespace: The namespace to list commands for. options: --raw: description: To output raw command list accept_value: no is_value_required: no is_multiple: no is_negatable: no default: false --format: description: The output format (txt, xml, json, or md) accept_value: yes is_value_required: yes is_multiple: no is_negatable: no default: 'txt' --short: description: To skip describing commands' arguments accept_value: no is_value_required: no is_multiple: no is_negatable: no default: false ``` -------------------------------- ### Symfony Console Descriptor Commands Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_2.rst Documentation for commands within the 'descriptor' namespace. This includes 'descriptor:command1', 'descriptor:command2', and 'descriptor:command4', detailing their usage, arguments, and options. ```APIDOC descriptor:command1 command 1 description Usage: descriptor:command1 alias1 alias2 command 1 help descriptor:command2 command 2 description Usage: descriptor:command2 [-o|--option_name] [--] descriptor:command2 -o|--option_name descriptor:command2 Arguments: argument_name: The name of the argument. Options: -o, --option_name: Description for option_name. descriptor:command4 Usage: descriptor:command4 descriptor:alias_command4 command4:descriptor ``` -------------------------------- ### Symfony Console Help Command Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_1.md Displays help information for a given command or the list command if no command is specified. Supports different output formats and raw output. ```APIDOC help [--format FORMAT] [--raw] [--] [] Display help for a command. The help command displays help for a given command: %%PHP_SELF%% help list You can also output the help in other formats by using the --format option: %%PHP_SELF%% help --format=xml list To display the list of available commands, please use the list command. Arguments: command_name The command name (default: 'help'). Options: --format The output format (txt, xml, json, or md) (required). --raw To output raw command help. --help|-h Display help for the given command. When no command is given display help for the list command. --silent Do not output any message. --quiet|-q Only errors are displayed. All other output is suppressed. --verbose|-v|-vv|-vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug. --version|-V Display this application version. --ansi|--no-ansi Force (or disable --no-ansi) ANSI output. --no-interaction|-n Do not ask any interactive question. ``` -------------------------------- ### Command with Arguments and Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_gethelp.txt Illustrates how to define and use arguments and options within a Symfony console command. Arguments are required values, while options are optional flags. ```PHP setDescription('Greets a user.') ->setHelp('This command greets a user by name. You can also greet them in a different language.') ->addArgument('name', InputArgument::REQUIRED, 'The name of the user to greet.') ->addOption('language', 'l', InputOption::VALUE_OPTIONAL, 'The language to greet in', 'en'); } protected function execute(InputInterface $input, OutputInterface $output) { $name = $input->getArgument('name'); $language = $input->getOption('language'); if ($language === 'en') { $greeting = 'Hello'; } elseif ($language === 'fr') { $greeting = 'Bonjour'; } else { $greeting = 'Hello'; } $output->writeln(sprintf('%s %s!', $greeting, $name)); return Command::SUCCESS; } } ``` -------------------------------- ### Define Command-Line Option Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/input_option_3.txt Demonstrates how to define a command-line option with its name and description using Symfony's Console Component. ```APIDOC -o, --option_name=OPTION_NAME option description ``` -------------------------------- ### Symfony Console Usage and Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_filtered_namespace.txt This section details the general usage of Symfony console commands, including common options for controlling verbosity, output format (ANSI), interaction, and displaying help or version information. ```APIDOC Project: /symfony/console My Symfony application v1.0 Usage: command [options] [arguments] Options: -h, --help Display help for the given command. When no command is given display help for the list command --silent Do not output any message -q, --quiet Only errors are displayed. All other output is suppressed -V, --version Display this application version --ansi|--no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Available commands for the "command4" namespace: command4:descriptor ``` -------------------------------- ### Symfony Console Usage and Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_mbstring.txt This section outlines the general usage pattern for Symfony console commands, including how to specify options and arguments. It details various command-line options available for controlling output verbosity, interaction, and formatting. ```APIDOC Usage: command [options] [arguments] Options: -h, --help Display help for the given command. When no command is given display help for the list command --silent Do not output any message -q, --quiet Only errors are displayed. All other output is suppressed -V, --version Display this application version --ansi|--no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug ``` -------------------------------- ### Basic Command Output Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_rendersynopsis_escapesline.txt Illustrates a simple command output format, indicating a command named 'foo' with an optional informational flag. ```php foo [] ``` -------------------------------- ### Symfony Console Help Command Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_mbstring.md Displays help for a given Symfony Console command. Supports various output formats like txt, xml, json, and md, and can output raw command help. ```APIDOC help [--format FORMAT] [--raw] [--] [] Arguments: command_name: The command name (default: 'help') Options: --format: The output format (txt, xml, json, or md) (default: 'txt') --raw: To output raw command help -h, --help: Display help for the given command. When no command is given display help for the list command --silent: Do not output any message -q, --quiet: Only errors are displayed. All other output is suppressed -v, -vv, -vvv, --verbose: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug -V, --version: Display this application version --ansi, --no-ansi: Force (or disable --no-ansi) ANSI output -n, --no-interaction: Do not ask any interactive question ``` -------------------------------- ### Symfony Console Argument/Option Syntax Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/input_definition_4.txt Illustrates the command-line syntax for passing arguments and options to Symfony Console commands. ```APIDOC Arguments: argument_name Options: -o, --option_name ``` -------------------------------- ### Symfony Console Usage and Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_2.txt Provides information on how to use the Symfony Console application, including common options for controlling output verbosity, interaction, and formatting. It also details the general command structure. ```APIDOC Project: /symfony/console My Symfony application v1.0 Usage: command [options] [arguments] Options: -h, --help Display help for the given command. When no command is given display help for the list command --silent Do not output any message -q, --quiet Only errors are displayed. All other output is suppressed -V, --version Display this application version --ansi|--no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug ``` -------------------------------- ### Define Command-line Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/input_option_5.txt Demonstrates how to define command-line options with short and long forms, including multi-line descriptions. This is crucial for creating user-friendly CLI tools. ```APIDOC -o, --option_name=OPTION_NAME multiline option description ``` -------------------------------- ### Symfony Console List Command Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_2.md Lists all available commands in the application. Can filter by namespace and supports different output formats. ```APIDOC list [--raw] [--format FORMAT] [--short] [] List commands Arguments: namespace The namespace name (default: NULL) Options: --raw To output raw command help --format FORMAT The output format (txt, xml, json, or md) (required) --short Only the names of the commands are returned -h, --help Display help for the given command. When no command is given display help for the list command --silent Do not output any message -q, --quiet Only errors are displayed. All other output is suppressed -v, -vv, -vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug -V, --version Display this application version --ansi, --no-ansi Force (or disable --no-ansi) ANSI output -n, --no-interaction Do not ask any interactive question ``` -------------------------------- ### descriptor:command2 Command Usage and Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/command_2.rst Provides detailed usage instructions, argument definitions, and option configurations for the 'descriptor:command2' command. It specifies how to invoke the command with or without options and arguments, and details the properties of the '--option_name' flag. ```APIDOC descriptor:command2 description: command 2 description usage: - "descriptor:command2 [-o|--option_name] [--] " - "descriptor:command2 -o|--option_name " - "descriptor:command2 " help: command 2 help arguments: argument_name: description: "" options: --option_name|-o: description: "" accept_value: "no" is_value_required: "no" is_multiple: "no" is_negatable: "no" default: "false" ``` -------------------------------- ### Symfony Console List Command Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_1.md Lists all available commands in the console application, optionally filtered by namespace. Supports raw output and different formatting options. ```APIDOC list [--raw] [--format FORMAT] [--short] [] List commands. The list command lists all commands: %%PHP_SELF%% list You can also display the commands for a specific namespace: %%PHP_SELF%% list test You can also output the information in other formats by using the --format option: %%PHP_SELF%% list --format=xml It's also possible to get raw list of commands (useful for embedding command runner): %%PHP_SELF%% list --raw Arguments: namespace The namespace name. Options: --raw To output raw command list. --format The output format (txt, xml, json, or md) (required). --short To skip describing commands' arguments. --help|-h Display help for the given command. When no command is given display help for the list command. --silent Do not output any message. --quiet|-q Only errors are displayed. All other output is suppressed. --verbose|-v|-vv|-vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug. --version|-V Display this application version. --ansi|--no-ansi Force (or disable --no-ansi) ANSI output. --no-interaction|-n Do not ask any interactive question. ``` -------------------------------- ### Console Option Definition Syntax Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/input_option_2.txt Illustrates the syntax for defining command-line options within the Symfony Console component, including short/long flags, descriptions, and default values. ```APIDOC -o, --option_name[=OPTION_NAME] option description [default: "default_value"] ``` -------------------------------- ### descriptor:command4 Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_2.md Documentation for 'command4' within the 'descriptor' namespace, including its various usage aliases. ```APIDOC descriptor:command4 Usage: descriptor:command4 descriptor:alias_command4 command4:descriptor ``` -------------------------------- ### Output Formatting Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_gethelp.txt Shows how to use different output formatting options provided by the Symfony Console Component, such as colors, bold text, and progress bars. ```PHP setDescription('Demonstrates output formatting.'); } protected function execute(InputInterface $input, OutputInterface $output) { // Basic output $output->writeln('This is a normal message.'); // Colored output $output->writeln('This is an info message.'); $output->writeln('This is a comment message.'); $output->writeln('This is a question message.'); $output->writeln('This is an error message.'); // Bold text $output->writeln('This text is bold'); // Progress bar $progressBar = new ProgressBar($output, 100); $progressBar->start(); for ($i = 0; $i < 100; $i++) { usleep(50000); $progressBar->advance(); } $progressBar->finish(); $output->writeln(''); // New line after progress bar return Command::SUCCESS; } } ``` -------------------------------- ### Symfony Console General Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_mbstring.md This section details common options available for most Symfony Console commands. These options control aspects like output verbosity, interaction, and formatting. ```APIDOC --short Description: To skip describing commands' arguments Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` --help|-h Description: Display help for the given command. When no command is given display help for the list command Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` --silent Description: Do not output any message Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` --quiet|-q Description: Only errors are displayed. All other output is suppressed Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` --verbose|-v|-vv|-vvv Description: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` --version|-V Description: Display this application version Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` --ansi|--no-ansi Description: Force (or disable --no-ansi) ANSI output Accept value: no Is value required: no Is multiple: no Is negatable: yes Default: `NULL` --no-interaction|-n Description: Do not ask any interactive question Accept value: no Is value required: no Is multiple: no Is negatable: no Default: `false` ``` -------------------------------- ### Defining Console Arguments Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/input_argument_3.txt Demonstrates how to define arguments for a Symfony Console command, including their names, descriptions, and default values. ```php use Symfony\Component\Console\Input\InputArgument; protected function configure() { $this ->addArgument( 'argument_name', InputArgument::OPTIONAL, 'argument description', 'default_value' ); } ``` -------------------------------- ### Defining Command-Line Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/input_option_5.rst This section describes how to define command-line options for Symfony Console commands. It covers the various properties that can be set for an option, such as its name, description, whether it accepts a value, and its default value. ```php use Symfony\Component\Console\Input\InputOption; // ... $this->addOption( 'option_name', 'o', InputOption::VALUE_REQUIRED, 'option description' ); ``` -------------------------------- ### Symfony Console Global Options Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_2.md Details common command-line options applicable to most Symfony Console commands. These options control output verbosity, interaction, and formatting. ```APIDOC --raw Output raw command list. Accepts: no Required: no Multiple: no Negatable: no Default: false --format The output format (txt, xml, json, or md). Accepts: yes Required: yes Multiple: no Negatable: no Default: 'txt' --short Skip describing commands' arguments. Accepts: no Required: no Multiple: no Negatable: no Default: false --help|-h Display help for the given command. When no command is given display help for the list command. Accepts: no Required: no Multiple: no Negatable: no Default: false --silent Do not output any message. Accepts: no Required: no Multiple: no Negatable: no Default: false --quiet|-q Only errors are displayed. All other output is suppressed. Accepts: no Required: no Multiple: no Negatable: no Default: false --verbose|-v|-vv|-vvv Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug. Accepts: no Required: no Multiple: no Negatable: no Default: false --version|-V Display this application version. Accepts: no Required: no Multiple: no Negatable: no Default: false --ansi|--no-ansi Force (or disable --no-ansi) ANSI output. Accepts: no Required: no Multiple: no Negatable: yes Default: NULL --no-interaction|-n Do not ask any interactive question. Accepts: no Required: no Multiple: no Negatable: no Default: false ``` -------------------------------- ### Defining Console Arguments Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/input_argument_4.txt Demonstrates how to define an argument for a Symfony console command, including its name and a multiline description. ```php $this->addArgument('argument_name', InputArgument::OPTIONAL, 'multiline\n argument description'); ``` -------------------------------- ### Symfony Console List Command Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/application_mbstring.md Lists all available commands in the Symfony Console application. Supports filtering by namespace and different output formats including raw. ```APIDOC list [--raw] [--format FORMAT] [--short] [] Arguments: namespace: The namespace name Options: --raw: To output raw command list --format: The output format (txt, xml, json, or md) (default: 'txt') --short: -h, --help: Display help for the given command. When no command is given display help for the list command --silent: Do not output any message -q, --quiet: Only errors are displayed. All other output is suppressed -v, -vv, -vvv, --verbose: Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug -V, --version: Display this application version --ansi, --no-ansi: Force (or disable --no-ansi) ANSI output -n, --no-interaction: Do not ask any interactive question ``` -------------------------------- ### Console Option Configuration Details Source: https://github.com/symfony/console/blob/7.3/Tests/Fixtures/input_option_2.rst Provides a detailed breakdown of the properties used to configure a console command option, such as whether it accepts a value, if that value is required, if multiple values are allowed, if it can be negated, and its default value. ```APIDOC Symfony Console Option Properties: --option_name|-o Description: option description Accept value: yes Is value required: no Is multiple: no Is negatable: no Default: 'default_value' ```