Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
uni20::cli::configuration Class Reference

Collect CLI input first, then resolve declared fallback sources after loading input attributes. More...

#include <configuration.hpp>

Public Member Functions

template<ConfigurationValue T>
requires (!presentation::data_table_detail::optional_traits<T>::optional)
configuration_binding & bind (CLI::Option *option, T &target, std::string id)
 Bind a declared CLI11 option to a stable metadata id, capturing its initialized value as default.
 
 configuration (CLI::App &app, uni20::configuration::environment_reader environment=[](std::string const &name) -> std::optional< std::string > { if(auto p=std::getenv(name.c_str())) return std::string(p);return std::nullopt;})
 
 configuration (configuration const &)=delete
 
void load_option_file ()
 Read the explicitly requested file using CLI11's configured TOML/INI reader.
 
configuration & operator= (configuration const &)=delete
 
CLI::Option * option_file (std::string names="--config")
 Register an explicit option-file path; help never opens the file.
 
parse_result parse (int argc, char const *const *argv, parse_policy policy={})
 
metadata_document resolve () const
 Resolve all bindings, assigning native CLI variables and returning owned metadata.
 
presentation::report_builder result_report (presentation::program_info const &program, parse_result const &result) const
 Include declared fallback sources in help, without evaluating or opening them.
 
uni20::configuration & values ()
 

Detailed Description

Collect CLI input first, then resolve declared fallback sources after loading input attributes.

The app, options and bound variables must outlive this adapter. It is single-use and supports scalar options/boolean flags, not subcommands or CLI11 needs/excludes constraints on bound options. Declare cross-field checks after resolve(). Ordinary unbound CLI11 options keep their semantics.

Constructor & Destructor Documentation

◆ configuration() [1/2]

uni20::cli::configuration::configuration ( CLI::App &  app,
uni20::configuration::environment_reader  environment = [](std::string const& name) -> std::optional<std::string> { if (auto p = std::getenv(name.c_str())) return std::string(p); return std::nullopt; } 
)
inlineexplicit

◆ configuration() [2/2]

uni20::cli::configuration::configuration ( configuration const &  )
delete

Member Function Documentation

◆ bind()

template<ConfigurationValue T>
requires (!presentation::data_table_detail::optional_traits<T>::optional)
configuration_binding & uni20::cli::configuration::bind ( CLI::Option *  option,
T &  target,
std::string  id 
)
inline

Bind a declared CLI11 option to a stable metadata id, capturing its initialized value as default.

Conversion and validators remain on the original CLI11 option. Fallback values cross that textual boundary using native round-trip formatting, including exact half-integers.

Precondition
target is the variable assigned by this option's original CLI11 callback.

◆ load_option_file()

void uni20::cli::configuration::load_option_file ( )
inline

Read the explicitly requested file using CLI11's configured TOML/INI reader.

Call after handling information actions and before bootstrap/input resolution.

◆ operator=()

configuration & uni20::cli::configuration::operator= ( configuration const &  )
delete

◆ option_file()

CLI::Option * uni20::cli::configuration::option_file ( std::string  names = "--config")
inline

Register an explicit option-file path; help never opens the file.

◆ parse()

parse_result uni20::cli::configuration::parse ( int  argc,
char const *const *  argv,
parse_policy  policy = {} 
)
inline

◆ resolve()

metadata_document uni20::cli::configuration::resolve ( ) const
inline

Resolve all bindings, assigning native CLI variables and returning owned metadata.

◆ result_report()

presentation::report_builder uni20::cli::configuration::result_report ( presentation::program_info const &  program,
parse_result const &  result 
) const
inline

Include declared fallback sources in help, without evaluating or opening them.

◆ values()

uni20::configuration & uni20::cli::configuration::values ( )
inline

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