30#include <wx/tokenzr.h>
32#define ARG_FORMAT "--format"
33#define ARG_UNITS "--units"
34#define ARG_SEVERITY_ALL "--severity-all"
35#define ARG_SEVERITY_ERROR "--severity-error"
36#define ARG_SEVERITY_WARNING "--severity-warning"
37#define ARG_SEVERITY_EXCLUSIONS "--severity-exclusions"
38#define ARG_EXIT_CODE_VIOLATIONS "--exit-code-violations"
45 m_argParser.add_description(
UTF8STDSTR(
_(
"Runs the Electrical Rules Check (ERC) on the schematic and creates a report" ) ) );
48 .default_value( std::string(
"report" ) )
49 .help(
UTF8STDSTR(
_(
"Output file format, options: json, report" ) ) );
52 .default_value( std::string(
"mm" ) )
54 _(
"Report units; valid options: in, mm, mils" ) ) );
57 .help(
UTF8STDSTR(
_(
"Report all ERC violations, this is equivalent to including all the other severity arguments" ) ) )
58 .implicit_value(
true )
59 .default_value(
false );
62 .help(
UTF8STDSTR(
_(
"Report all ERC error level violations, this can be combined with the other severity arguments" ) ) )
63 .implicit_value(
true )
64 .default_value(
false );
67 .help(
UTF8STDSTR(
_(
"Report all ERC warning level violations, this can be combined with the other severity arguments" ) ) )
68 .implicit_value(
true )
69 .default_value(
false );
72 .help(
UTF8STDSTR(
_(
"Report all excluded ERC violations, this can be combined with the other severity arguments" ) ) )
73 .implicit_value(
true )
74 .default_value(
false );
77 .help(
UTF8STDSTR(
_(
"Return a exit code depending on whether or not violations exist" ) ) )
78 .implicit_value(
true )
79 .default_value(
false );
85 std::unique_ptr<JOB_SCH_ERC> ercJob(
new JOB_SCH_ERC(
true ) );
87 ercJob->m_outputFile = m_argOutput;
88 ercJob->m_filename = m_argInput;
90 ercJob->SetVarOverrides( m_argDefineVars );
113 if( units == wxS(
"mm" ) )
117 else if( units == wxS(
"in" ) )
121 else if( units == wxS(
"mils" ) )
125 else if( !units.IsEmpty() )
127 wxFprintf( stderr,
_(
"Invalid units specified\n" ) );
132 if( format ==
"report" )
136 else if( format ==
"json" )
142 wxFprintf( stderr,
_(
"Invalid report format\n" ) );
argparse::ArgumentParser m_argParser
void addDefineArg()
Sets up the drawing sheet arg used by many of the export commands.
void addCommonArgs(bool aInput, bool aOutput, bool aInputIsDir, bool aOutputIsDir)
Sets up the most common of args used across cli.
int doPerform(KIWAY &aKiway) override
The internal handler that should be overloaded to implement command specific processing and work.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
int ProcessJob(KIWAY::FACE_T aFace, JOB *job)
#define ARG_SEVERITY_EXCLUSIONS
#define ARG_SEVERITY_ERROR
#define ARG_SEVERITY_WARNING
#define ARG_EXIT_CODE_VIOLATIONS
This file contains miscellaneous commonly used macros and functions.
static const int ERR_ARGS
wxString From_UTF8(const char *cstring)