KiCad PCB EDA Suite
CLI::PCB_COMMAND Struct Reference

#include <command_pcb.h>

Inheritance diagram for CLI::PCB_COMMAND:
CLI::COMMAND

Public Member Functions

 PCB_COMMAND ()
 
int Perform (KIWAY &aKiway)
 Entry point to processing commands from args and doing work. More...
 
argparse::ArgumentParser & GetArgParser ()
 
const std::string & GetName () const
 
void PrintHelp ()
 

Protected Member Functions

virtual int doPerform (KIWAY &aKiway)
 The internal handler that should be overloaded to implement command specific processing and work. More...
 

Protected Attributes

std::string m_name
 
argparse::ArgumentParser m_argParser
 

Detailed Description

Definition at line 28 of file command_pcb.h.

Constructor & Destructor Documentation

◆ PCB_COMMAND()

CLI::PCB_COMMAND::PCB_COMMAND ( )
inline

Definition at line 30 of file command_pcb.h.

30: COMMAND( "pcb" ) {}
COMMAND(const std::string &aName)
Define a new COMMAND instance.
Definition: command.cpp:29

Member Function Documentation

◆ doPerform()

int CLI::COMMAND::doPerform ( KIWAY aKiway)
protectedvirtualinherited

The internal handler that should be overloaded to implement command specific processing and work.

If not overloaded, the command will simply emit the help options by default

Reimplemented in CLI::EXPORT_PCB_BASE_COMMAND, CLI::EXPORT_PCB_DRILL_COMMAND, CLI::EXPORT_PCB_DXF_COMMAND, CLI::EXPORT_PCB_GERBER_COMMAND, CLI::EXPORT_PCB_GERBERS_COMMAND, CLI::EXPORT_PCB_PDF_COMMAND, CLI::EXPORT_PCB_POS_COMMAND, CLI::EXPORT_PCB_STEP_COMMAND, CLI::EXPORT_PCB_SVG_COMMAND, CLI::EXPORT_SCH_NETLIST_COMMAND, CLI::EXPORT_SCH_PDF_COMMAND, CLI::EXPORT_SCH_PYTHONBOM_COMMAND, CLI::EXPORT_SCH_SVG_COMMAND, CLI::FP_EXPORT_SVG_COMMAND, CLI::FP_UPGRADE_COMMAND, CLI::SYM_EXPORT_SVG_COMMAND, CLI::SYM_UPGRADE_COMMAND, and CLI::VERSION_COMMAND.

Definition at line 62 of file command.cpp.

63{
64 // default case if we aren't overloaded, just print the help
65 PrintHelp();
66
67 return EXIT_CODES::OK;
68}
void PrintHelp()
Definition: command.cpp:41
static const int OK
Definition: exit_codes.h:30

References CLI::EXIT_CODES::OK.

◆ GetArgParser()

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

Definition at line 54 of file command.h.

54{ return m_argParser; }
argparse::ArgumentParser m_argParser
Definition: command.h:68

References CLI::COMMAND::m_argParser.

Referenced by recurseArgParserBuild(), and recurseArgParserSubCommandUsed().

◆ GetName()

const std::string & CLI::COMMAND::GetName ( void  ) const
inlineinherited

Definition at line 55 of file command.h.

55{ return m_name; }
std::string m_name
Definition: command.h:67

References CLI::COMMAND::m_name.

Referenced by recurseArgParserSubCommandUsed().

◆ Perform()

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

Entry point to processing commands from args and doing work.

Definition at line 49 of file command.cpp.

50{
51 if( m_argParser[ARG_HELP] == true )
52 {
53 PrintHelp();
54
55 return 0;
56 }
57
58 return doPerform( aKiway );
59}
virtual int doPerform(KIWAY &aKiway)
The internal handler that should be overloaded to implement command specific processing and work.
Definition: command.cpp:62
#define ARG_HELP
Definition: command.h:30

References ARG_HELP.

◆ PrintHelp()

void CLI::COMMAND::PrintHelp ( )
inherited

Definition at line 41 of file command.cpp.

42{
43 std::stringstream ss;
44 ss << m_argParser;
45 wxPrintf( FROM_UTF8( ss.str().c_str() ) );
46}
static wxString FROM_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition: macros.h:110

References FROM_UTF8().

Member Data Documentation

◆ m_argParser

◆ m_name

std::string CLI::COMMAND::m_name
protectedinherited

Definition at line 67 of file command.h.

Referenced by CLI::COMMAND::GetName().


The documentation for this struct was generated from the following file: