kaycxx-cli
C++ CLI library
Loading...
Searching...
No Matches
Public Member Functions | List of all members
kaycxx::cli::flag Class Reference

Command line flag definition. More...

#include <kaycxx/cli/flag.hpp>

Inheritance diagram for kaycxx::cli::flag:
Inheritance graph
[legend]
Collaboration diagram for kaycxx::cli::flag:
Collaboration graph
[legend]

Public Member Functions

std::string usage () const override
 Returns generated help usage for this flag.
 
bool expects_value () const noexcept override
 Checks whether this flag expects a value.
 
 switch_base (std::string_view name, std::optional< std::string_view > description=std::nullopt)
 Creates a switch without a short alias.
 
 switch_base (std::string_view name, char alias, std::optional< std::string_view > description=std::nullopt)
 Creates a switch with a short alias.
 
- Public Member Functions inherited from kaycxx::cli::switch_base
 switch_base (std::string_view name, std::optional< std::string_view > description=std::nullopt)
 Creates a switch without a short alias.
 
 switch_base (std::string_view name, char alias, std::optional< std::string_view > description=std::nullopt)
 Creates a switch with a short alias.
 
virtual ~switch_base ()=default
 Destroys the switch definition.
 
std::string constname () const noexcept
 Returns the long switch name.
 
std::optional< charalias () const noexcept
 Returns the short switch alias.
 
std::optional< std::string > constdescription () const noexcept
 Returns the switch description.
 
void mark_as_action () noexcept
 Marks this switch as a mutually exclusive command action.
 
bool is_action () const noexcept
 Checks whether this switch is a command action.
 

Detailed Description

Command line flag definition.

A flag is a switch without a value. It is either present or absent in parsed arguments.

Member Function Documentation

◆ expects_value()

bool kaycxx::cli::flag::expects_value ( ) const
overridevirtualnoexcept

Checks whether this flag expects a value.

Returns
Always false.

Implements kaycxx::cli::switch_base.

◆ switch_base() [1/2]

kaycxx::cli::switch_base::switch_base ( std::string_view  name,
char  alias,
std::optional< std::string_view >  description = std::nullopt 
)
explicit

Creates a switch with a short alias.

Parameters
nameLong switch name without the leading --.
aliasShort switch alias without the leading -.
descriptionOptional human-readable description used by generated help output.

◆ switch_base() [2/2]

kaycxx::cli::switch_base::switch_base ( std::string_view  name,
std::optional< std::string_view >  description = std::nullopt 
)
explicit

Creates a switch without a short alias.

Parameters
nameLong switch name without the leading --.
descriptionOptional human-readable description used by generated help output.

◆ usage()

std::string kaycxx::cli::flag::usage ( ) const
overridevirtual

Returns generated help usage for this flag.

Returns
Usage text.

Implements kaycxx::cli::switch_base.


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