ALib C++ Library
Library Version: 2402 R1
Documentation generated by doxygen
Loading...
Searching...
No Matches
cli.cpp
1// #################################################################################################
2// ALib C++ Library
3//
4// Copyright 2013-2024 A-Worx GmbH, Germany
5// Published under 'Boost Software License' (a free software license, see LICENSE.txt)
6// #################################################################################################
8
9#if !defined(ALIB_DOX)
10# if !defined (HPP_ALIB_CLI_CLI)
12# endif
13
14# if !defined(HPP_ALIB_ENUMS_SERIALIZATION)
16# endif
17# if !defined (HPP_ALIB_ENUMS_RECORDBOOTSTRAP)
19# endif
20# if !defined (HPP_ALIB_LANG_BASECAMP)
22# endif
23#endif // !defined(ALIB_DOX)
24
25
27
28namespace alib {
29
31
32/** ************************************************************************************************
33 * This is the reference documentation of sub-namespace \c cli of the \aliblink, which
34 * holds types of library module \alib_cli_nl.
35 *
36 * Besides this reference documentation, further documentation and source code samples for this
37 * module is provided with \ref alib_mod_cli "ALib Module CLI - Programmer's Manual".
38 **************************************************************************************************/
39namespace cli {
40
42: Camp( "CLI" )
43{
44 ALIB_ASSERT_ERROR( this == &CLI, "CLI",
45 "Instances of class Cli must not be created. Use singleton alib::CLI" )
46}
47
48#define EOS ,
50{
52 {
55
56
57#if !ALIB_RESOURCES_OMIT_DEFAULTS
59
60 //--------- Exceptions ------
61 "E<" , A_CHAR( "cli::" ),
62
63 // general exceptions
64 "E0", A_CHAR( "1,NoCommandGiven" ",ED1" ),
65 "E1", A_CHAR( "2,UnknownCommand" ",ED2" ),
66
67 // option parsing exceptions
68 "E2", A_CHAR( "10,ParsingOptions" ",ED10" ),
69 "E3", A_CHAR( "11,MissingOptionValue" ",ED11" ),
70 "E4", A_CHAR( "12,IllegalOptionNameContinuation" ",ED12" ),
71
72 // command parsing exceptions
73 "E5", A_CHAR( "20,ParsingCommand" ",ED20" ),
74 "E6", A_CHAR( "21,MissingParameterValue" ",ED21" ) EOS
75
76 // messages of general exceptions
77 "ED1", A_CHAR( "No command given." ),
78 "ED2", A_CHAR( "Unknown command found with CLI argument{!Q[]}={!Q}" ),
79 "ED10", A_CHAR( "Error parsing option. Usage:\n"
80 "{}" ),
81 "ED20", A_CHAR( "Error parsing command.\n"
82 "Usage: {}\n"
83 "{}" ),
84
85
86 // messages of internal exceptions
87 "ED11", A_CHAR( "Missing argument(s) of option {!Q<>} found with CLI argument{!Q[]}={!Q}.\n"
88 "Expected {}, given {}." ),
89
90 "ED12", A_CHAR( "Option identifier {!Q<>} found at start of CLI argument{!Q[]}={!Q},\n"
91 "while CLI argument string continues with non-argument identifier characters." ),
92
93 "ED21", A_CHAR( "Missing argument(s) of parameter {!Q<>} found with CLI argument{!Q[]}={!Q}.\n"
94 "Quantity expected {}, quantity given {}." ) EOS
95
96
97 //--------- DryRunModes ------
98 "DRM<", A_CHAR( "DryRunModes::" ),
99DOX_MARKER([DOX_ALIB_CLI_DRYRUN_RESOURCES])
100"DRM" , A_CHAR( "0" "," "Off" "," "1" ","
101 "2" "," "CLIDeclarations" "," "4" ","
102 "1" "," "CLIArgs" "," "1" ","
103 "3" "," "Application" "," "1" ),
104DOX_MARKER([DOX_ALIB_CLI_DRYRUN_RESOURCES])
105 // end of BootstrapBulk()
106 nullptr );
107#endif // !ALIB_RESOURCES_OMIT_DEFAULTS
108
109 }
110
111 else if( phase == BootstrapPhases::PrepareConfig )
112 {
115 }
116}
117
118
119}} // namespace alib::cli
virtual void bootstrap(BootstrapPhases phase) override
Definition cli.cpp:49
NCString ResourceCategory
Definition camp.hpp:142
lang::resources::ResourcePool * resourcePool
Definition camp.hpp:98
virtual void BootstrapBulk(const nchar *category,...)=0
#define ALIB_BOXING_VTABLE_DEFINE(TMapped, Identifier)
Definition vtable.inl:490
#define A_CHAR(STR)
#define ALIB_BOXING_BOOTSTRAP_REGISTER_FAPPEND_FOR_APPENDABLE_TYPE(TAppendable)
#define ALIB_BOXING_BOOTSTRAP_VTABLE_DBG_REGISTER(Identifier)
Definition vtable.inl:506
#define ALIB_ASSERT_ERROR(cond,...)
Definition alib.hpp:984
Exceptions
Definition cli.hpp:73
Definition alib.cpp:57
cli::Cli CLI
Definition cli.cpp:30
BootstrapPhases
Definition camp.hpp:26
@ PrepareConfig
Initializes up to the creation of a field config .
static void Bootstrap(TEnum element, TArgs &&... args) noexcept