Ookii.CommandLine for C++
1.0.0
|
Provides options for how to format usage help for applications using shell commands. More...
#include <ookii/shell_command_usage_options.h>
Classes | |
struct | defaults |
Provides default values for the fields of basic_shell_command_usage_options. More... | |
Public Types | |
using | base_type = basic_usage_options< CharType, Traits, Alloc > |
The concrete base class of thes type. | |
using | stream_type = typename base_type::stream_type |
The concrete stream type used. | |
using | string_type = typename base_type::string_type |
The concrete string type used. | |
![]() | |
using | stream_type = std::basic_ostream< CharType, std::char_traits< CharType > > |
The concrete stream type used. | |
using | string_type = std::basic_string< CharType, std::char_traits< CharType >, std::allocator< CharType > > |
The concrete string type used. | |
Public Member Functions | |
basic_shell_command_usage_options ()=default | |
Initializes a new instance of the basic_shell_command_usage_options class. More... | |
basic_shell_command_usage_options (stream_type &output) | |
Initializes a new instance of the basic_shell_command_usage_options class with the specified stream. More... | |
basic_shell_command_usage_options (stream_type &output, stream_type &error) | |
Initializes a new instance of the basic_shell_command_usage_options class with the specified output and error streams. More... | |
![]() | |
basic_usage_options () | |
Initializes a new instance of the basic_usage_options class. More... | |
basic_usage_options (stream_type &output) | |
Initializes a new instance of the basic_usage_options class with the specified stream. More... | |
basic_usage_options (stream_type &output, stream_type &error) | |
Initializes a new instance of the basic_usage_options class with the specified output and error streams. More... | |
Public Attributes | |
string_type | available_commands_header {defaults::available_commands_header.data()} |
The header to show above the list of available commands. | |
string_type | command_format {defaults::command_format.data()} |
The format for showing a command in the list of commands. More... | |
size_t | command_indent {defaults::command_indent} |
The level of indentation to use when writing the list of commands. More... | |
string_type | command_usage_format {defaults::command_usage_format.data()} |
The usage syntax format shown when no command was specified, or an unknown command was specified. More... | |
![]() | |
string_type | alias_format |
The format to use for the aliases of an argument. More... | |
string_type | alias_separator |
The separator to use if the argument has more than one alias. | |
string_type | argument_description_format |
The format to use for the description of an argument. More... | |
size_t | argument_description_indent |
The level of indentation to use when writing argument descriptions. More... | |
string_type | default_value_format |
The format to use for the default value of an argument. More... | |
stream_type & | error |
The stream used to write errors to. | |
bool | include_aliases_in_description |
Indicates whether to include the aliases of arguments in the description. More... | |
bool | include_default_value_in_description |
Indicates whether to include the default value of arguments in the description. More... | |
string_type | multi_value_suffix |
Suffix to add to the syntax of multi-value arguments. | |
string_type | optional_argument_format |
The format to use for the syntax of an optional argument. More... | |
stream_type & | output |
The stream used to write usage help to. | |
size_t | syntax_indent |
The level of indentation to use when writing the usage syntax. More... | |
string_type | usage_prefix_format |
The format to use for the prefix to the usage syntax. More... | |
bool | use_white_space_value_separator |
Indicates whether to use white space as the argument name separator in the usage syntax. More... | |
string_type | value_description_format |
The format to use for the value description of an argument. More... | |
Provides options for how to format usage help for applications using shell commands.
This type is used by the basic_shell_command_manager to determine how to show errors, a list of commands, or usage help for a specific command.
Two typedefs for common character types are provided:
Type | Definition |
---|---|
ookii::shell_command_usage_options | ookii::basic_shell_command_usage_options<char> |
ookii::wshell_command_usage_options | ookii::basic_shell_command_usage_options<wchar_t> |
CharType | The character type used for arguments and other strings. |
Traits | The character traits to use for strings. Defaults to std::char_traits<CharType> . |
Alloc | The allocator to use for strings. Defaults to std::allocator<CharType> . |
|
default |
Initializes a new instance of the basic_shell_command_usage_options class.
This instance will write to a line_wrapping_ostream for the standard output stream and the standard input stream.
|
inline |
Initializes a new instance of the basic_shell_command_usage_options class with the specified stream.
This instance will write both errors and usage to the same stream.
output | The stream used for usage help and errors. |
|
inline |
Initializes a new instance of the basic_shell_command_usage_options class with the specified output and error streams.
output | The stream used for usage help. |
error | The stream used for errors. |
string_type ookii::basic_shell_command_usage_options< CharType, Traits, Alloc >::command_format {defaults::command_format.data()} |
The format for showing a command in the list of commands.
This value must contain {}
placeholders for the command name and the command description.
size_t ookii::basic_shell_command_usage_options< CharType, Traits, Alloc >::command_indent {defaults::command_indent} |
The level of indentation to use when writing the list of commands.
Note that the first line of each command is not indented.
This value has no effect if the output stream is not using a line_wrapping_streambuf.
string_type ookii::basic_shell_command_usage_options< CharType, Traits, Alloc >::command_usage_format {defaults::command_usage_format.data()} |
The usage syntax format shown when no command was specified, or an unknown command was specified.
This value must contain one {}
placeholder for the application name.