3

I'm trying to obtain the complete list of Drush Output Formats. I'm using drush 9.0-dev and in the Output formats section of the Drush Documentation it says:

The list of formats shown is abbreviated; to see the complete list of available formats, run the help command with the --verbose option.

I tried drush help --verbose, but I can't find the information.

Is there another way to have access to this information?

3

To see the verbose list of output formats use help with a command name. For example the help for the watchdog list command drush help wd-list:

Normally you get:

 --format=<json>                           Select output format. Available: table, csv, html, json, list, var_export, yaml.
                                           Default is table.

But if you use --verbose:

drush --verbose help wd-list

You get the full list:

 --format=<json>                           Select output format.
                                           All available values are:
                                            - table: A formatted, word-wrapped table.
                                            - config: A configuration file in executable php format. The variable name is
                                           "config", and the variable keys are taken from the output data array's keys.
                                            - csv: A list of values, one per row, each of which is a comma-separated list of
                                           values.
                                            - html: An HTML representation
                                            - json: Javascript Object Notation.
                                            - labeled-export: A list of php exports, labeled with a name.
                                            - list: A simple list of values.
                                            - php: A serialized php string.
                                            - print-r: Output via php print_r function.
                                            - var_export: An array in executable php format.
                                            - variables: A list of php variable assignments.
                                            - yaml: Yaml output format.
                                           Default is table.

To get a global detailed list of all formats defined in drush you can use the drush function outputformat_drush_engine_outputformat():

drush ev 'var_dump(outputformat_drush_engine_outputformat())'

EDIT:

If you want to see only the format names you can use:

drush ev 'print_r(array_keys(outputformat_drush_engine_outputformat()))'

Output:

[0] => table
[1] => key-value
[2] => key-value-list
[3] => json
[4] => string
[5] => message
[6] => print-r
[7] => var_export
[8] => yaml
[9] => php
[10] => config
[11] => list
[12] => nested-csv
[13] => csv-or-string
[14] => csv
[15] => variables
[16] => labeled-export
[17] => html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.