paludis  Version 2.6.0
Public Member Functions | Friends | List of all members
examples::CommandLine Class Reference

#include <example_command_line.hh>

+ Inheritance diagram for examples::CommandLine:

Public Member Functions

virtual void run (const int, const char *const *const, const std::string &client, const std::string &env_var, const std::string &env_prefix)
 
- Public Member Functions inherited from paludis::args::ArgsHandler
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())
 
ParametersConstIterator begin_parameters () const
 
ParametersConstIterator end_parameters () const
 
IteratorRange< ParametersConstIteratorparameters () const
 
bool empty () const
 
const std::shared_ptr< const Sequence< std::string > > separate_after_dashes_args () const PALUDIS_ATTRIBUTE((warn_unused_result))
 
UsageLineConstIterator begin_usage_lines () const
 
UsageLineConstIterator end_usage_lines () const
 
IteratorRange< UsageLineConstIteratorusage_lines () const
 
EnvironmentLineConstIterator begin_environment_lines () const
 
EnvironmentLineConstIterator end_environment_lines () const
 
IteratorRange< EnvironmentLineConstIteratorenvironment_lines () const
 
ExamplesConstIterator begin_examples () const
 
ExamplesConstIterator end_examples () const
 
IteratorRange< ExamplesConstIteratorexamples () const
 
ArgsSectionsConstIterator begin_args_sections () const
 
ArgsSectionsConstIterator end_args_sections () const
 
IteratorRange< ArgsSectionsConstIteratorargs_sections () const
 
ArgsSectionmain_options_section () PALUDIS_ATTRIBUTE((warn_unused_result))
 
NotesIterator begin_notes () const
 
NotesIterator end_notes () const
 
IteratorRange< NotesIteratornotes () const
 
DescriptionLineConstIterator begin_description_lines () const
 
DescriptionLineConstIterator end_description_lines () const
 
IteratorRange< DescriptionLineConstIteratordescription_lines () const
 
SeeAlsoConstIterator begin_see_alsos () const
 
SeeAlsoConstIterator end_see_alsos () const
 
IteratorRange< SeeAlsoConstIteratorsee_alsos () const
 
 ArgsHandler ()
 
virtual ~ArgsHandler ()
 
 ArgsHandler (const ArgsHandler &)=delete
 
ArgsHandleroperator= (const ArgsHandler &)=delete
 
virtual std::string man_section () const
 
- Public Member Functions inherited from paludis::Singleton< CommandLine >
 Singleton ()=default
 
 Singleton (const Singleton &)=delete
 
const Singletonoperator= (const Singleton &)=delete
 

Friends

class paludis::Singleton< CommandLine >
 

Program information

virtual std::string app_name () const
 
virtual std::string app_synopsis () const
 
virtual std::string app_description () const
 

Action arguments

paludis::args::ArgsGroup action_args
 
paludis::args::SwitchArg a_version
 
paludis::args::SwitchArg a_help
 

General arguments

{

paludis::args::ArgsGroup general_args
 
paludis::args::LogLevelArg a_log_level
 
paludis::args::StringArg a_environment
 

Additional Inherited Members

- Public Types inherited from paludis::args::ArgsHandler
typedef WrappedForwardIterator< ParametersConstIteratorTag, const std::string > ParametersConstIterator
 
typedef WrappedForwardIterator< UsageLineConstIteratorTag, const std::string > UsageLineConstIterator
 
typedef WrappedForwardIterator< EnvironmentLineConstIteratorTag, const std::pair< std::string, std::string > > EnvironmentLineConstIterator
 
typedef WrappedForwardIterator< ExamplesConstIteratorTag, const std::pair< std::string, std::string > > ExamplesConstIterator
 
typedef WrappedForwardIterator< ArgsSectionsConstIteratorTag, const ArgsSectionArgsSectionsConstIterator
 
typedef WrappedForwardIterator< NotesIteratorTag, const std::string > NotesIterator
 
typedef WrappedForwardIterator< DescriptionLineConstIteratorTag, const std::string > DescriptionLineConstIterator
 
typedef WrappedForwardIterator< SeeAlsoConstIteratorTag, const std::pair< std::string, int > > SeeAlsoConstIterator
 
typedef WrappedForwardIterator< ArgsIteratorTag, std::string > ArgsIterator
 
- Static Public Member Functions inherited from paludis::Singleton< CommandLine >
static CommandLine * get_instance () PALUDIS_ATTRIBUTE((warn_unused_result))
 
static void destroy_instance ()
 
- Protected Member Functions inherited from paludis::args::ArgsHandler
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 ()
 

Detailed Description

This class provides basic command line handling for most examples.

Most Paludis clients should support at least '–help', '–version' and '–log-level'. If paludis::EnvironmentFactory is used to create the environment then '–environment' must also be an option.

Clients are free to use whichever command line handling library they prefer, but for convenience all Paludis core clients use a common utility library with a much simpler interface than that provided by overly C-ish getopt derivatives.

The command line is a singleton – that is, only one instance of it exists globally. This avoids the need to pass around lots of parameters.

Member Function Documentation

std::string CommandLine::app_description ( ) const
virtual

Long description of what our application is.

Implements paludis::args::ArgsHandler.

std::string CommandLine::app_name ( ) const
virtual

What is our application name?

Implements paludis::args::ArgsHandler.

std::string CommandLine::app_synopsis ( ) const
virtual

One line synopsis of what our application is.

Implements paludis::args::ArgsHandler.


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