33#include <sptk5/RegularExpression.h>
34#include <sptk5/cutils>
78 std::shared_ptr<RegularExpression> m_regexp;
97 const Strings& sortedCommands,
size_t helpTextColumns)
const;
108 const Strings& sortedOptions,
size_t helpTextColumns)
const;
141 const String& validateValue,
158 void init(
size_t argc,
const char** argv);
301 void printHelp(
size_t nameWidth,
size_t textWidth,
const String& optionDefaultValue)
const;
411 const String& validateValue,
437 std::shared_ptr<RegularExpression> m_validateValue;
443 String m_commandLinePrototype;
444 std::map<String, std::shared_ptr<CommandLineElement>> m_optionTemplates;
449 std::map<String, std::shared_ptr<CommandLineArgument>> m_argumentTemplates;
450 std::map<String, String> m_values;
452 fs::path m_executablePath;
453 std::list<std::shared_ptr<CommandLineElement>> m_allElements;
457 void readOption(
const Strings& digestedArgs,
size_t& i);
Definition: CommandLine.h:333
~CommandLineArgument() override=default
CommandLineArgument(const String &name, const String &help)
Definition: CommandLine.h:221
bool useWithCommand(const String &command) const
virtual ~CommandLineElement()=default
virtual void validate(const String &value) const
virtual String name() const
Type
Definition: CommandLine.h:227
virtual String shortName() const
void printHelp(size_t nameWidth, size_t textWidth, const String &optionDefaultValue) const
virtual String printableName() const
virtual Type type() const
virtual bool hasValue() const
CommandLineElement(const String &name, const String &shortName, const String &help, const Visibility &useWithCommands)
void formatHelp(size_t textWidth, Strings &formattedText) const
Definition: CommandLine.h:356
CommandLineElement::Type type() const override
String printableName() const override
CommandLineOption(const String &name, const String &shortName, const Visibility &useWithCommands, const String &help)
bool hasValue() const override
~CommandLineOption() override=default
Definition: CommandLine.h:399
void validate(const String &value) const override
CommandLineParameter(const String &name, const String &shortName, const String &valueName, const String &validateValue, const Visibility &useWithCommands, const String &help)
bool hasValue() const override
Type type() const override
String printableName() const override
Definition: CommandLine.h:57
bool matches(const String &command) const
Visibility(const String &pattern, bool mustMatch=true)
Definition: CommandLine.h:47
static void printLine(const String &ch, size_t count)
bool hasOption(const String &name) const
static Strings preprocessArguments(const std::vector< const char * > &argv)
void init(size_t argc, const char **argv)
void defineOption(const String &fullName, const String &shortName, const Visibility &useForCommands, const String &help)
CommandLine(const String &programVersion, const String &description, const String &commandLinePrototype)
void printHelp(const String &onlyForCommand, size_t screenColumns) const
String getOptionValue(const String &name) const
const Strings & arguments() const
void printCommands(const String &onlyForCommand, size_t screenColumns, size_t nameColumns, const Strings &sortedCommands, size_t helpTextColumns) const
void defineParameter(const String &fullName, const String &shortName, const String &valueName, const String &validateValue, const Visibility &useForCommands, const String &defaultValue, const String &help)
void setOptionValue(const String &name, const String &value="yes")
void printOptions(const String &onlyForCommand, size_t screenColumns, size_t nameColumns, const Strings &sortedOptions, size_t helpTextColumns) const
static Strings rewriteArguments(const Strings &arguments)
void printVersion() const
void defineArgument(const String &fullName, const String &helpText)
void printHelp(size_t screenColumns) const