10#if !defined (HPP_ALIB_CLI_COMMANDLINE)
14#if !defined (HPP_ALIB_CLI_CLIUTIL)
18#if !defined (HPP_ALIB_LANG_BASECAMP)
40 #if !ALIB_CHARACTERS_WIDE
43 for (
int i= 1; i <
ArgC ; ++i )
55 for (
int i= 1; i <
ArgC ; ++i )
63 #if ALIB_CHARACTERS_NATIVE_WCHAR
66 for (
int i= 1; i <
ArgC ; ++i )
79 for (
int i= 1; i <
ArgC ; ++i )
101 auto argNo=
ArgsLeft[
static_cast<size_t>(argIdx)];
107 if( arg.CharAtStart() !=
'-' )
122 if( option->
Read( **optionDeclIt, arg, argNo ) )
130 (*optionDeclIt)->HelpUsageLine() );
167 for(
auto optionIt=
Options.rbegin() ; optionIt !=
Options.rend() ; optionIt ++ )
168 if( (*optionIt)->Declaration->Element() == element )
177 bool lastCommandFullyParsed=
true;
178 while( lastCommandFullyParsed &&
ArgsLeft.size() > 0 )
187 lastCommandFullyParsed= command->
Read( *commandDecl );
193 commandDecl->HelpTextShort() );
250 ALIB_ERROR(
"CLI",
"Argument number {} already removed.", argNo )
static ALIB_API AString GetCommandUsageFormat(CommandLine &cmdLine, CommandDecl &commandDecl)
lang::resources::ResourcePool * Resources
List< OptionDecl * > OptionDecls
void Init(lang::Camp *resModule)
virtual ALIB_API Command * NextCommand()
List< Command * >::Iterator NextCommandIt
virtual String GetArg(integer idx)
List< Command * > CommandsParsed
NCString ResourceCategory
virtual ALIB_API void ReadOptions()
std::vector< String, StdContMA< String > > ArgStrings
virtual ALIB_API String PopArg()
ALIB_API void RemoveArg(integer argNo)
ALIB_API Option * GetOption(Enum element)
virtual ALIB_API void ReadNextCommands()
List< String, Recycling::Shared > OptionArgsIgnored
List< CommandDecl * > CommandDecls
std::vector< integer, StdContMA< integer > > ArgsLeft
const String & ShortcutReplacementString()
Exception & Add(const NCString &file, int line, const NCString &func, TEnum type, TArgs &&... args)
ALIB_FORCE_INLINE T * Emplace(TArgs &&... args)
strings::TString< TChar > EmplaceString(const strings::TString< TChar > &src)
void DbgDisableBufferReplacementWarning()
constexpr bool IsNotEmpty() const
#define ALIB_CALLER_NULLED
#define ALIB_WARNINGS_RESTORE
#define ALIB_ASSERT_ERROR(cond,...)
#define ALIB_WARNINGS_ALLOW_UNSAFE_BUFFER_USAGE
@ ParsingOptions
General option parse error. Adds option help text.
@ ParsingCommand
General parameter parse error. Adds command help text.
@ NoCommandGiven
Unknown command given.
@ UnknownCommand
Unknown command given.
lang::Exception Exception
Type alias in namespace alib.
constexpr String NullString()
lang::integer integer
Type alias in namespace alib.
ALIB_API bool Read(CommandDecl &decl)
ALIB_API bool Read(OptionDecl &decl, String &arg, const integer argNo)