Ookii.CommandLine for C++  1.0.0
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
ookii::basic_shell_command_usage_options< CharType, Traits, Alloc > Class Template Reference

Provides options for how to format usage help for applications using shell commands. More...

#include <ookii/shell_command_usage_options.h>

Inheritance diagram for ookii::basic_shell_command_usage_options< CharType, Traits, Alloc >:
Inheritance graph
[legend]
Collaboration diagram for ookii::basic_shell_command_usage_options< CharType, Traits, Alloc >:
Collaboration graph
[legend]

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.
 
- Public Types inherited from ookii::basic_usage_options< CharType, std::char_traits< CharType >, std::allocator< CharType > >
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...
 
- Public Member Functions inherited from ookii::basic_usage_options< CharType, std::char_traits< CharType >, std::allocator< CharType > >
 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...
 
- Public Attributes inherited from ookii::basic_usage_options< CharType, std::char_traits< CharType >, std::allocator< CharType > >
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_typeerror
 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_typeoutput
 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...
 

Detailed Description

template<typename CharType, typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
class ookii::basic_shell_command_usage_options< CharType, Traits, Alloc >

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>
Template Parameters
CharTypeThe character type used for arguments and other strings.
TraitsThe character traits to use for strings. Defaults to std::char_traits<CharType>.
AllocThe allocator to use for strings. Defaults to std::allocator<CharType>.

Constructor & Destructor Documentation

◆ basic_shell_command_usage_options() [1/3]

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
ookii::basic_shell_command_usage_options< CharType, Traits, Alloc >::basic_shell_command_usage_options ( )
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.

◆ basic_shell_command_usage_options() [2/3]

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
ookii::basic_shell_command_usage_options< CharType, Traits, Alloc >::basic_shell_command_usage_options ( stream_type output)
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.

Parameters
outputThe stream used for usage help and errors.

◆ basic_shell_command_usage_options() [3/3]

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
ookii::basic_shell_command_usage_options< CharType, Traits, Alloc >::basic_shell_command_usage_options ( stream_type output,
stream_type error 
)
inline

Initializes a new instance of the basic_shell_command_usage_options class with the specified output and error streams.

Parameters
outputThe stream used for usage help.
errorThe stream used for errors.

Member Data Documentation

◆ command_format

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
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.

◆ command_indent

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
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.

◆ command_usage_format

template<typename CharType , typename Traits = std::char_traits<CharType>, typename Alloc = std::allocator<CharType>>
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.


The documentation for this class was generated from the following file: