kaycxx-cli
C++ CLI library
Loading...
Searching...
No Matches
Public Member Functions | Friends | List of all members
kaycxx::cli::repeatable_option_handle< T > Class Template Reference

Handle for a registered repeatable option. More...

#include <kaycxx/cli/repeatable_option_handle.hpp>

Public Member Functions

repeatable_option_handle action () noexcept
 Marks the option as a mutually exclusive command action.
 
repeatable_option_handle required ()
 Requires the option to be specified at least once.
 
option< T > constdefinition () const noexcept
 Returns the underlying option definition.
 
repeatable_option_handle default_value (T value)
 Sets a default option value.
 

Friends

class command
 

Detailed Description

template<parseable_value T>
class kaycxx::cli::repeatable_option_handle< T >

Handle for a registered repeatable option.

The handle does not own the option definition. It references data owned by the command that created it.

Template Parameters
TOption value type.

Member Function Documentation

◆ action()

template<parseable_value T>
repeatable_option_handle kaycxx::cli::repeatable_option_handle< T >::action ( )
inlinenoexcept

Marks the option as a mutually exclusive command action.

Returns
This handle for chaining.

◆ default_value()

template<parseable_value T>
repeatable_option_handle kaycxx::cli::repeatable_option_handle< T >::default_value ( T  value)
inline

Sets a default option value.

When the option is absent, the value is returned as the only element of its result vector.

Custom value types must support stream insertion with operator<< so the default can be rendered in generated help.

Parameters
valueDefault value used when the option is not present in parsed arguments.
Returns
This handle for chaining.
Exceptions
std::invalid_argumentWhen the option is required.

◆ definition()

template<parseable_value T>
option< T > const & kaycxx::cli::repeatable_option_handle< T >::definition ( ) const
inlinenoexcept

Returns the underlying option definition.

Returns
Option definition owned by the command.

◆ required()

template<parseable_value T>
repeatable_option_handle kaycxx::cli::repeatable_option_handle< T >::required ( )
inline

Requires the option to be specified at least once.

Returns
This handle for chaining.
Exceptions
std::invalid_argumentWhen a default value is configured.

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