32 m_argParser( aName,
"", argparse::default_arguments::none ),
52 wxPrintf(
From_UTF8( ss.str().c_str() ) );
84 for(
const std::string& def : defines )
90 if( bits.Count() == 2 )
105 for(
const auto&
name : variantNames )
113 _(
"When specifying multiple variants, the output path must contain "
114 "${VARIANT} to generate separate output files for each variant.\n" ) );
147 .metavar(
"INPUT_FILE" );
154 .metavar(
"INPUT_DIR" );
160 .help(
UTF8STDSTR(
_(
"Input file or directory" ) ) )
161 .metavar(
"INPUT_FILE_OR_DIR" );
173 .default_value( std::string() )
175 .metavar(
"OUTPUT_DIR" );
180 .default_value( std::string() )
182 .metavar(
"OUTPUT_FILE" );
193 .default_value( std::string() )
194 .help(
UTF8STDSTR(
_(
"Path to drawing sheet, this overrides any existing project "
195 "defined sheet when used" ) ) )
196 .metavar(
"SHEET_PATH" );
205 .default_value( std::vector<std::string>() )
208 _(
"Overrides or adds project variables, can be used multiple times to "
209 "declare multiple variables."
210 "\nUse in the format of '--define-var key=value' or '-D key=value'" ) ) )
211 .metavar(
"KEY=VALUE" );
220 .default_value( std::vector<std::string>() )
223 _(
"The variant name(s) to output, can be used multiple times to specify "
224 "multiple variants.\n"
225 "When specifying multiple variants, use ${VARIANT} in the output path to "
226 "generate separate files for each variant.\n"
227 "When no --variant argument is provided the default variant is output." ) ) );
std::string m_name
Name of this command that is exported and used in the cli.
std::map< wxString, wxString > m_argDefineVars
Value of the drawing sheet arg if configured.
virtual int doPerform(KIWAY &aKiway)
The internal handler that should be overloaded to implement command specific processing and work.
bool m_hasDefineArg
Whether or not the input arg was added for parsing.
void addVariantsArg()
Set up the list of variants to output arguement.
argparse::ArgumentParser m_argParser
bool m_hasOutputArg
Whether or not the output arg was added for parsing.
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.
bool m_outputArgExpectsDir
Whether or not the output arg is expecting a directory.
int Perform(KIWAY &aKiway)
Entry point to processing commands from args and doing work.
wxString m_argDrawingSheet
Value of the drawing sheet arg if configured.
void addCommonArgs(bool aInput, bool aOutput, INPUT_TYPE aInputType, bool aOutputIsDir)
Set up the most common of args used across cli.
wxString m_argOutput
Value of the output arg if configured.
wxString m_argInput
Value of the common input arg if configured.
std::vector< wxString > m_argVariantNames
The list of variant names to output.
bool m_hasInputArg
Whether or not the input arg was added for parsing.
void addDrawingSheetArg()
Set up the drawing sheet arg used by many of the export commands.
bool m_hasVariantArg
Whether or not the input argument for variant names was added for parsing.
bool m_hasDrawingSheetArg
Whether or not the input arg was added for parsing.
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.