charmhelpers.cli package¶
charmhelpers.cli.host module¶
- charmhelpers.cli.host.mounts()¶
List mounts
- class charmhelpers.cli.CommandLine¶
Bases: object
- argument_parser = None¶
- formatter = None¶
- run()¶
Run cli, processing arguments and executing subcommands.
- subcommand(command_name=None)¶
Decorate a function as a subcommand. Use its arguments as the command-line arguments
- subcommand_builder(command_name, description=None)¶
Decorate a function that builds a subcommand. Builders should accept a single argument (the subparser instance) and return the function to be run as the command.
- subparsers = None¶
- class charmhelpers.cli.OutputFormatter(outfile=<open file '<stdout>', mode 'w' at 0x7f2b85375150>)¶
Bases: object
- add_arguments(argument_parser)¶
- csv(output)¶
Output data as excel-compatible CSV
- format_output(output, fmt='raw')¶
- json(output)¶
Output data in JSON format
- py(output)¶
Output data as a nicely-formatted python data structure
- raw(output)¶
Output data as raw string (default)
- supported_formats¶
- tab(output)¶
Output data in excel-compatible tab-delimited format
- yaml(output)¶
Output data in YAML format
- charmhelpers.cli.describe_arguments(func)¶
Analyze a function’s signature and return a data structure suitable for passing in as arguments to an argparse parser’s add_argument() method.