32 m_argParser( aName,
"", argparse::default_arguments::none ),
33 m_hasInputArg( false ),
34 m_hasOutputArg( false ),
35 m_hasDrawingSheetArg( false ),
36 m_hasDefineArg( false ),
37 m_outputArgExpectsDir( false )
41 .default_value(
false )
43 .implicit_value(
true )
52 wxPrintf(
From_UTF8( ss.str().c_str() ) );
58 if( m_argParser[
ARG_HELP ] ==
true )
75 if( m_hasDrawingSheetArg )
85 for(
const std::string& def : defines )
91 if( bits.Count() == 2 )
93 m_argDefineVars[bits[0]] = bits[1];
102 return doPerform( aKiway );
117 m_hasInputArg = aInput;
118 m_hasOutputArg = aOutput;
119 m_outputArgExpectsDir = aOutputIsDir;
127 .metavar(
"INPUT_DIR" );
133 .metavar(
"INPUT_FILE" );
142 .default_value( std::string() )
144 .metavar(
"OUTPUT_DIR" );
149 .default_value( std::string() )
151 .metavar(
"OUTPUT_FILE" );
159 m_hasDrawingSheetArg =
true;
162 .default_value( std::string() )
163 .help(
UTF8STDSTR(
_(
"Path to drawing sheet, this overrides any existing project "
164 "defined sheet when used" ) ) )
165 .metavar(
"SHEET_PATH" );
171 m_hasDefineArg =
true;
174 .default_value( std::vector<std::string>() )
177 _(
"Overrides or adds project variables, can be used multiple times to "
178 "declare multiple variables."
179 "\nUse in the format of '--define-var key=value' or '-D key=value'" ) ) )
180 .metavar(
"KEY=VALUE" );
virtual int doPerform(KIWAY &aKiway)
The internal handler that should be overloaded to implement command specific processing and work.
argparse::ArgumentParser m_argParser
COMMAND(const std::string &aName)
Define a new COMMAND instance.
void addDefineArg()
Set up the drawing sheet arg used by many of the export commands.
int Perform(KIWAY &aKiway)
Entry point to processing commands from args and doing work.
void addCommonArgs(bool aInput, bool aOutput, bool aInputIsDir, bool aOutputIsDir)
Set up the most common of args used across cli.
void addDrawingSheetArg()
Set up the drawing sheet arg used by many of the export commands.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
#define ARG_DRAWING_SHEET
#define ARG_DEFINE_VAR_LONG
#define ARG_DEFINE_VAR_SHORT
This file contains miscellaneous commonly used macros and functions.
static const int ERR_ARGS
wxString From_UTF8(const char *cstring)
void wxStringSplit(const wxString &aText, wxArrayString &aStrings, wxChar aSplitter)
Split aString to a string list separated at aSplitter.