![]() |
Shamrock 2025.10.0
Astrophysical Code
|
#include "shambase/exception.hpp"#include "shambase/print.hpp"#include "shambase/string.hpp"#include "shambase/term_colors.hpp"#include "shamcmdopt/cmdopt.hpp"#include "shamcmdopt/details/generic_opts.hpp"#include "shamcmdopt/env.hpp"#include <string_view>#include <algorithm>#include <iostream>#include <optional>#include <stdexcept>#include <string>#include <utility>#include <vector>
Include dependency graph for cmdopt.cpp:Go to the source code of this file.
Classes | |
| class | ShamCmdOptException |
| Exception handler for exeption in this lib. More... | |
| struct | shamcmdopt::Opts |
| Struct for data related to an option. More... | |
Namespaces | |
| namespace | shamcmdopt |
| namespace for cli utilities | |
Functions | |
| bool | shamcmdopt::is_name_registered (const std::string_view &name) |
| Check if the option name is registered. | |
| void | shamcmdopt::check_args_registered () |
| Check if all argument passed to shamrock where registered otherwise throw. | |
| void | shamcmdopt::check_init () |
| Check if init has been performed otherwise throw. | |
| bool | shamcmdopt::has_option (const std::string_view &option_name) |
| Check if an option is present. | |
| std::string_view | shamcmdopt::get_option (const std::string_view &option_name) |
| Get the value of an option. | |
| void | shamcmdopt::register_opt (std::string name, std::optional< std::string > args, std::string description) |
| Register a command line option. | |
| void | shamcmdopt::init (int argc, char *argv[]) |
| Initialize the command line option parser. We also process generic options in this call (color detection typically) | |
| int | shamcmdopt::get_argc () |
| Get the number of command line arguments. | |
| char ** | shamcmdopt::get_argv () |
| Get the command line arguments. | |
| void | shamcmdopt::print_help () |
| Print the help message. | |
| void | shamcmdopt::print_completion_zsh () |
| print zsh completion script to be sourced | |
| bool | shamcmdopt::is_help_mode () |
| Check if the help mode is enabled. | |
Variables | |
| auto | shamcmdopt::err_str |
| Error string to be printed in case of failure. | |
| std::string_view | shamcmdopt::executable_name |
| Executable name. | |
| std::vector< std::string_view > | shamcmdopt::args |
| Executable argument list (mapped from argv) | |
| bool | shamcmdopt::init_done |
| Has cmdopt init been called. | |
| std::vector< Opts > | shamcmdopt::registered_opts |
| Registered cli options. | |
| int | shamcmdopt::argc |
| supplied argc from main | |
| char ** | shamcmdopt::argv |
| supplied argv from main | |
Definition in file cmdopt.cpp.