|
paludis Version 3.0.2
The one true package mangler
|
#include <args_handler.hh>
Public Member Functions | |
| void | add_option (ArgsOption *const, const std::string &long_name, const char short_name='\0') |
| void | remove_option (const std::string &long_name, const char short_name='\0') |
| void | run (const int argc, const char *const *const argv, const std::string &client, const std::string &env_var, const std::string &env_prefix, const ArgsHandlerOptions &options=ArgsHandlerOptions()) |
| void | run (const std::shared_ptr< const Sequence< std::string > > &, const std::string &client, const std::string &env_var, const std::string &env_prefix, const ArgsHandlerOptions &options=ArgsHandlerOptions()) |
Protected Member Functions | |
| void | add_usage_line (const std::string &l) |
| void | add_environment_variable (const std::string &e, const std::string &desc) |
| void | add_example (const std::string &e, const std::string &desc) |
| void | add_note (const std::string &) |
| void | add_description_line (const std::string &l) |
| void | add_see_also (const std::string &, int section) |
| void | add (ArgsSection *const) |
| void | dump_to_stream (std::ostream &s) const |
| virtual void | post_run () |
Friends | |
| class | ArgsSection |
| std::ostream & | operator<< (std::ostream &, const ArgsHandler &) |
Iterate over our parameters (non - and – switches and their values) | |
| typedef WrappedForwardIterator< ParametersConstIteratorTag, const std::string > | ParametersConstIterator |
| ParametersConstIterator | begin_parameters () const |
| ParametersConstIterator | end_parameters () const |
| IteratorRange< ParametersConstIterator > | parameters () const |
| bool | empty () const |
| const std::shared_ptr< const Sequence< std::string > > | separate_after_dashes_args () const PALUDIS_ATTRIBUTE((warn_unused_result)) |
Iterate over our usage lines (for documentation) | |
| typedef WrappedForwardIterator< UsageLineConstIteratorTag, const std::string > | UsageLineConstIterator |
| UsageLineConstIterator | begin_usage_lines () const |
| UsageLineConstIterator | end_usage_lines () const |
| IteratorRange< UsageLineConstIterator > | usage_lines () const |
Iterate over our environment lines (for documentation) | |
| typedef WrappedForwardIterator< EnvironmentLineConstIteratorTag, const std::pair< std::string, std::string > > | EnvironmentLineConstIterator |
| EnvironmentLineConstIterator | begin_environment_lines () const |
| EnvironmentLineConstIterator | end_environment_lines () const |
| IteratorRange< EnvironmentLineConstIterator > | environment_lines () const |
Iterate over our examples (for documentation) | |
| typedef WrappedForwardIterator< ExamplesConstIteratorTag, const std::pair< std::string, std::string > > | ExamplesConstIterator |
| ExamplesConstIterator | begin_examples () const |
| ExamplesConstIterator | end_examples () const |
| IteratorRange< ExamplesConstIterator > | examples () const |
Iterate over our sections | |
| typedef WrappedForwardIterator< ArgsSectionsConstIteratorTag, const ArgsSection > | ArgsSectionsConstIterator |
| ArgsSectionsConstIterator | begin_args_sections () const |
| ArgsSectionsConstIterator | end_args_sections () const |
| IteratorRange< ArgsSectionsConstIterator > | args_sections () const |
| ArgsSection * | main_options_section () PALUDIS_ATTRIBUTE((warn_unused_result)) |
Iterate over our notes | |
| typedef WrappedForwardIterator< NotesIteratorTag, const std::string > | NotesIterator |
| NotesIterator | begin_notes () const |
| NotesIterator | end_notes () const |
| IteratorRange< NotesIterator > | notes () const |
Iterate over our extra description lines (for documentation) | |
| typedef WrappedForwardIterator< DescriptionLineConstIteratorTag, const std::string > | DescriptionLineConstIterator |
| DescriptionLineConstIterator | begin_description_lines () const |
| DescriptionLineConstIterator | end_description_lines () const |
| IteratorRange< DescriptionLineConstIterator > | description_lines () const |
Iterate over our 'see also' lines | |
| typedef WrappedForwardIterator< SeeAlsoConstIteratorTag, const std::pair< std::string, int > > | SeeAlsoConstIterator |
| SeeAlsoConstIterator | begin_see_alsos () const |
| SeeAlsoConstIterator | end_see_alsos () const |
| IteratorRange< SeeAlsoConstIterator > | see_alsos () const |
For use by ArgsVisitor | |
| typedef WrappedForwardIterator< ArgsIteratorTag, std::string > | ArgsIterator |
Basic operations | |
| ArgsHandler (const ArgsHandler &)=delete | |
| ArgsHandler & | operator= (const ArgsHandler &)=delete |
About our application (for documentation) | |
| virtual std::string | app_name () const =0 |
| virtual std::string | man_section () const |
| virtual std::string | app_synopsis () const =0 |
| virtual std::string | app_description () const =0 |
Handles command line arguments.
|
protected |
Add an new ArgsSection (called by the ArgsSection constructor).
|
protected |
Add a new description.
|
protected |
Add a new environment line.
|
protected |
Add a new example.
|
protected |
Add a new note.
| void paludis::args::ArgsHandler::add_option | ( | ArgsOption * const | , |
| const std::string & | long_name, | ||
| const char | short_name = '\0' ) |
|
protected |
Add a 'see also' item.
|
protected |
Add a new usage line.
|
pure virtual |
Long description of what our application is.
Implemented in examples::CommandLine.
|
pure virtual |
What is our application name?
Implemented in examples::CommandLine.
References app_name().
Referenced by app_name().
|
pure virtual |
One line synopsis of what our application is.
Implemented in examples::CommandLine.
|
protected |
Dump, for –help output (called by operator<<).
| ArgsSection * paludis::args::ArgsHandler::main_options_section | ( | ) |
|
inlinevirtual |
What is our application's Unix manual section?
References man_section().
Referenced by man_section().
|
protectedvirtual |
Called after run(), for convenience. Does nothing.
| void paludis::args::ArgsHandler::remove_option | ( | const std::string & | long_name, |
| const char | short_name = '\0' ) |
| void paludis::args::ArgsHandler::run | ( | const int | argc, |
| const char *const *const | argv, | ||
| const std::string & | client, | ||
| const std::string & | env_var, | ||
| const std::string & | env_prefix, | ||
| const ArgsHandlerOptions & | options = ArgsHandlerOptions() ) |
Parse command line arguments. The third argument is used to set PALUDIS_CLIENT. The fourth argument is the name of an environment variable holding arguments which are prepended to the command line arguments. The fifth argument is used as a prefix to export our command line via the environment.
| void paludis::args::ArgsHandler::run | ( | const std::shared_ptr< const Sequence< std::string > > & | , |
| const std::string & | client, | ||
| const std::string & | env_var, | ||
| const std::string & | env_prefix, | ||
| const ArgsHandlerOptions & | options = ArgsHandlerOptions() ) |
Parse command line arguments. The third argument is used to set PALUDIS_CLIENT. The fourth argument is the name of an environment variable holding arguments which are prepended to the command line arguments. The fifth argument is used as a prefix to export our command line via the environment.
| const std::shared_ptr< const Sequence< std::string > > paludis::args::ArgsHandler::separate_after_dashes_args | ( | ) | const |
If aho_separate_after_dashes, everything after a – goes here.
References PALUDIS_ATTRIBUTE.
|
friend |
Output an ArgsHandler to an ostream, for –help output.