KiCad PCB EDA Suite
Loading...
Searching...
No Matches
CLI::COMMAND Class Reference

#include <command.h>

Inheritance diagram for CLI::COMMAND:
CLI::FP_COMMAND CLI::FP_EXPORT_COMMAND CLI::JOBSET_COMMAND CLI::JOBSET_RUN_COMMAND CLI::PCB_COMMAND CLI::PCB_DRC_COMMAND CLI::PCB_EXPORT_3D_COMMAND CLI::PCB_EXPORT_BASE_COMMAND CLI::PCB_EXPORT_COMMAND CLI::PCB_RENDER_COMMAND CLI::SCH_COMMAND CLI::SCH_ERC_COMMAND CLI::SCH_EXPORT_BOM_COMMAND CLI::SCH_EXPORT_COMMAND CLI::SCH_EXPORT_NETLIST_COMMAND CLI::SCH_EXPORT_PLOT_COMMAND CLI::SCH_EXPORT_PYTHONBOM_COMMAND CLI::SYM_COMMAND CLI::SYM_EXPORT_COMMAND CLI::SYM_EXPORT_SVG_COMMAND CLI::SYM_UPGRADE_COMMAND CLI::VERSION_COMMAND

Public Member Functions

 COMMAND (const std::string &aName)
 Define a new COMMAND instance.
 
int Perform (KIWAY &aKiway)
 Entry point to processing commands from args and doing work.
 
virtual ~COMMAND ()=default
 
argparse::ArgumentParser & GetArgParser ()
 
const std::string & GetName () const
 
void PrintHelp ()
 

Protected Member Functions

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.
 
void addDefineArg ()
 Set up the drawing sheet arg used by many of the export commands.
 
virtual int doPerform (KIWAY &aKiway)
 The internal handler that should be overloaded to implement command specific processing and work.
 

Protected Attributes

std::string m_name
 Name of this command that is exported and used in the cli.
 
argparse::ArgumentParser m_argParser
 
bool m_hasInputArg
 Whether or not the input arg was added for parsing.
 
bool m_hasOutputArg
 Whether or not the output arg was added for parsing.
 
bool m_hasDrawingSheetArg
 Whether or not the input arg was added for parsing.
 
bool m_hasDefineArg
 Whether or not the input arg was added for parsing.
 
bool m_outputArgExpectsDir
 Whether or not the output arg is expecting a directory.
 
wxString m_argInput
 Value of the common input arg if configured.
 
wxString m_argOutput
 Value of the output arg if configured.
 
wxString m_argDrawingSheet
 Value of the drawing sheet arg if configured.
 
std::map< wxString, wxString > m_argDefineVars
 Value of the drawing sheet arg if configured.
 

Detailed Description

Definition at line 42 of file command.h.

Constructor & Destructor Documentation

◆ COMMAND()

CLI::COMMAND::COMMAND ( const std::string &  aName)

Define a new COMMAND instance.

Parameters
aNameThe name of the command that is to be used in the cli interface

Definition at line 30 of file command.cpp.

References ARG_HELP, ARG_HELP_DESC, ARG_HELP_SHORT, m_argParser, and UTF8STDSTR.

◆ ~COMMAND()

virtual CLI::COMMAND::~COMMAND ( )
virtualdefault

Member Function Documentation

◆ addCommonArgs()

void CLI::COMMAND::addCommonArgs ( bool  aInput,
bool  aOutput,
bool  aInputIsDir,
bool  aOutputIsDir 
)
protected

◆ addDefineArg()

◆ addDrawingSheetArg()

◆ doPerform()

◆ GetArgParser()

argparse::ArgumentParser & CLI::COMMAND::GetArgParser ( )
inline

Definition at line 59 of file command.h.

References m_argParser.

Referenced by recurseArgParserBuild(), and recurseArgParserSubCommandUsed().

◆ GetName()

const std::string & CLI::COMMAND::GetName ( ) const
inline

Definition at line 60 of file command.h.

References m_name.

Referenced by recurseArgParserSubCommandUsed().

◆ Perform()

int CLI::COMMAND::Perform ( KIWAY aKiway)

Entry point to processing commands from args and doing work.

Definition at line 56 of file command.cpp.

References ARG_DEFINE_VAR_LONG, ARG_DRAWING_SHEET, ARG_HELP, ARG_INPUT, ARG_OUTPUT, CLI::EXIT_CODES::ERR_ARGS, From_UTF8(), and wxStringSplit().

◆ PrintHelp()

void CLI::COMMAND::PrintHelp ( )

Definition at line 48 of file command.cpp.

References From_UTF8().

Member Data Documentation

◆ m_argDefineVars

std::map<wxString, wxString> CLI::COMMAND::m_argDefineVars
protected

Value of the drawing sheet arg if configured.

Definition at line 145 of file command.h.

◆ m_argDrawingSheet

wxString CLI::COMMAND::m_argDrawingSheet
protected

Value of the drawing sheet arg if configured.

Definition at line 140 of file command.h.

◆ m_argInput

wxString CLI::COMMAND::m_argInput
protected

Value of the common input arg if configured.

Definition at line 130 of file command.h.

◆ m_argOutput

wxString CLI::COMMAND::m_argOutput
protected

Value of the output arg if configured.

Definition at line 135 of file command.h.

◆ m_argParser

argparse::ArgumentParser CLI::COMMAND::m_argParser
protected

Definition at line 100 of file command.h.

Referenced by COMMAND(), CLI::FP_COMMAND::FP_COMMAND(), CLI::FP_EXPORT_COMMAND::FP_EXPORT_COMMAND(), CLI::FP_EXPORT_SVG_COMMAND::FP_EXPORT_SVG_COMMAND(), CLI::FP_UPGRADE_COMMAND::FP_UPGRADE_COMMAND(), GetArgParser(), CLI::JOBSET_COMMAND::JOBSET_COMMAND(), CLI::JOBSET_RUN_COMMAND::JOBSET_RUN_COMMAND(), CLI::PCB_COMMAND::PCB_COMMAND(), CLI::PCB_DRC_COMMAND::PCB_DRC_COMMAND(), CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND(), CLI::PCB_EXPORT_COMMAND::PCB_EXPORT_COMMAND(), CLI::PCB_EXPORT_DRILL_COMMAND::PCB_EXPORT_DRILL_COMMAND(), CLI::PCB_EXPORT_DXF_COMMAND::PCB_EXPORT_DXF_COMMAND(), CLI::PCB_EXPORT_GENCAD_COMMAND::PCB_EXPORT_GENCAD_COMMAND(), CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND(), CLI::PCB_EXPORT_GERBERS_COMMAND::PCB_EXPORT_GERBERS_COMMAND(), CLI::PCB_EXPORT_IPC2581_COMMAND::PCB_EXPORT_IPC2581_COMMAND(), CLI::PCB_EXPORT_ODB_COMMAND::PCB_EXPORT_ODB_COMMAND(), CLI::PCB_EXPORT_PDF_COMMAND::PCB_EXPORT_PDF_COMMAND(), CLI::PCB_EXPORT_POS_COMMAND::PCB_EXPORT_POS_COMMAND(), CLI::PCB_EXPORT_SVG_COMMAND::PCB_EXPORT_SVG_COMMAND(), CLI::PCB_RENDER_COMMAND::PCB_RENDER_COMMAND(), CLI::SCH_COMMAND::SCH_COMMAND(), CLI::SCH_ERC_COMMAND::SCH_ERC_COMMAND(), CLI::SCH_EXPORT_BOM_COMMAND::SCH_EXPORT_BOM_COMMAND(), CLI::SCH_EXPORT_COMMAND::SCH_EXPORT_COMMAND(), CLI::SCH_EXPORT_NETLIST_COMMAND::SCH_EXPORT_NETLIST_COMMAND(), CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND(), CLI::SCH_EXPORT_PYTHONBOM_COMMAND::SCH_EXPORT_PYTHONBOM_COMMAND(), CLI::SYM_COMMAND::SYM_COMMAND(), CLI::SYM_EXPORT_COMMAND::SYM_EXPORT_COMMAND(), CLI::SYM_EXPORT_SVG_COMMAND::SYM_EXPORT_SVG_COMMAND(), CLI::SYM_UPGRADE_COMMAND::SYM_UPGRADE_COMMAND(), and CLI::VERSION_COMMAND::VERSION_COMMAND().

◆ m_hasDefineArg

bool CLI::COMMAND::m_hasDefineArg
protected

Whether or not the input arg was added for parsing.

Definition at line 120 of file command.h.

◆ m_hasDrawingSheetArg

bool CLI::COMMAND::m_hasDrawingSheetArg
protected

Whether or not the input arg was added for parsing.

Definition at line 115 of file command.h.

◆ m_hasInputArg

bool CLI::COMMAND::m_hasInputArg
protected

Whether or not the input arg was added for parsing.

Definition at line 105 of file command.h.

◆ m_hasOutputArg

bool CLI::COMMAND::m_hasOutputArg
protected

Whether or not the output arg was added for parsing.

Definition at line 110 of file command.h.

◆ m_name

std::string CLI::COMMAND::m_name
protected

Name of this command that is exported and used in the cli.

Definition at line 98 of file command.h.

Referenced by GetName().

◆ m_outputArgExpectsDir

bool CLI::COMMAND::m_outputArgExpectsDir
protected

Whether or not the output arg is expecting a directory.

Definition at line 125 of file command.h.


The documentation for this class was generated from the following files: