Use the new flag() shorthand for arg setup

This commit is contained in:
Marek Roszko 2024-01-03 21:39:54 -05:00
parent 58af6b8dea
commit 675e126eae
16 changed files with 64 additions and 128 deletions

View File

@ -52,8 +52,7 @@ CLI::FP_EXPORT_SVG_COMMAND::FP_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND( "
m_argParser.add_argument( ARG_BLACKANDWHITE )
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}

View File

@ -38,8 +38,7 @@ CLI::FP_UPGRADE_COMMAND::FP_UPGRADE_COMMAND() : PCB_EXPORT_BASE_COMMAND( "upgrad
m_argParser.add_argument( ARG_FORCE )
.help( UTF8STDSTR(
_( "Forces the footprint library to be resaved regardless of versioning" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}

View File

@ -53,8 +53,7 @@ CLI::PCB_DRC_COMMAND::PCB_DRC_COMMAND() : COMMAND( "drc" )
m_argParser.add_argument( ARG_ALL_TRACK_ERRORS )
.help( UTF8STDSTR( _( "Report all errors for each track" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_UNITS )
.default_value( std::string( "mm" ) )
@ -64,31 +63,26 @@ CLI::PCB_DRC_COMMAND::PCB_DRC_COMMAND() : COMMAND( "drc" )
m_argParser.add_argument( ARG_SEVERITY_ALL )
.help( UTF8STDSTR( _( "Report all DRC violations, this is equivalent to including "
"all the other severity arguments" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_SEVERITY_ERROR )
.help( UTF8STDSTR( _( "Report all DRC error level violations, this can be combined "
"with the other severity arguments" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_SEVERITY_WARNING )
.help( UTF8STDSTR( _( "Report all DRC warning level violations, this can be combined "
"with the other severity arguments" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_SEVERITY_EXCLUSIONS )
.help( UTF8STDSTR( _( "Report all excluded DRC violations, this can be combined with "
"the other severity arguments" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_EXIT_CODE_VIOLATIONS )
.help( UTF8STDSTR( _( "Return a nonzero exit code if DRC violations exist" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}

View File

@ -68,20 +68,17 @@ CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND( const std::string& aNa
m_argParser.add_argument( ARG_FORCE, "-f" )
.help( UTF8STDSTR( _( "Overwrite output file" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
if( m_format == JOB_EXPORT_PCB_3D::FORMAT::STEP || m_format == JOB_EXPORT_PCB_3D::FORMAT::GLB )
{
m_argParser.add_argument( ARG_GRID_ORIGIN )
.help( UTF8STDSTR( _( "Use Grid Origin for output origin" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_DRILL_ORIGIN )
.help( UTF8STDSTR( _( "Use Drill Origin for output origin" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_NO_UNSPECIFIED )
.help( UTF8STDSTR( _(
@ -92,19 +89,16 @@ CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND( const std::string& aNa
m_argParser.add_argument( ARG_NO_DNP )
.help( UTF8STDSTR(
_( "Exclude 3D models for components with 'Do not populate' attribute" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "--subst-models" )
.help( UTF8STDSTR( _( "Substitute STEP or IGS models with the same name in place "
"of VRML models" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_BOARD_ONLY )
.help( UTF8STDSTR( _( "Only generate a board with no components" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_INCLUDE_TRACKS )
.help( UTF8STDSTR( _( "Export tracks" ) ) )
@ -113,8 +107,7 @@ CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND( const std::string& aNa
m_argParser.add_argument( ARG_INCLUDE_ZONES )
.help( UTF8STDSTR( _( "Export zones" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_MIN_DISTANCE )
.default_value( std::string( "0.01mm" ) )
@ -128,8 +121,7 @@ CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND( const std::string& aNa
m_argParser.add_argument( ARG_NO_OPTIMIZE_STEP )
.help( UTF8STDSTR( _( "Do not optimize STEP file (enables writing parametric "
"curves)" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}
m_argParser.add_argument( ARG_USER_ORIGIN )
@ -153,8 +145,7 @@ CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND( const std::string& aNa
m_argParser.add_argument( ARG_VRML_MODELS_RELATIVE )
.help( UTF8STDSTR( _( "Used with --models-dir to output relative paths in the "
"resulting file" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}
}

View File

@ -74,23 +74,19 @@ CLI::PCB_EXPORT_DRILL_COMMAND::PCB_EXPORT_DRILL_COMMAND() : PCB_EXPORT_BASE_COMM
m_argParser.add_argument( ARG_EXCELLON_MIRRORY )
.help( UTF8STDSTR( _( "Mirror Y axis" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_EXCELLON_MINIMALHEAD )
.help( UTF8STDSTR( _( "Minimal header" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_EXCELLON_SEPARATE_TH )
.help( UTF8STDSTR( _( "Generate independent files for NPTH and PTH holes" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_GENERATE_MAP )
.help( UTF8STDSTR( _( "Generate map / summary of drill hits" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_MAP_FORMAT )
.default_value( std::string( "pdf" ) )

View File

@ -44,23 +44,19 @@ CLI::PCB_EXPORT_DXF_COMMAND::PCB_EXPORT_DXF_COMMAND() : PCB_EXPORT_BASE_COMMAND(
m_argParser.add_argument( "--erd", ARG_EXCLUDE_REFDES )
.help( UTF8STDSTR( _( "Exclude the reference designator text" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "--ev", ARG_EXCLUDE_VALUE )
.help( UTF8STDSTR( _( "Exclude the value text" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "--uc", ARG_USE_CONTOURS )
.help( UTF8STDSTR( _( "Plot graphic items using their contours" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "--ibt", ARG_INCLUDE_BORDER_TITLE )
.help( UTF8STDSTR( _( "Include the border and title block" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "--ou", ARG_OUTPUT_UNITS )
.default_value( std::string( "in" ) )

View File

@ -42,33 +42,27 @@ CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND( const std::string& aN
m_argParser.add_argument( "--erd", ARG_EXCLUDE_REFDES )
.help( UTF8STDSTR( _( "Exclude the reference designator text" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "--ev", ARG_EXCLUDE_VALUE )
.help( UTF8STDSTR( _( "Exclude the value text" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "--ibt", ARG_INCLUDE_BORDER_TITLE )
.help( UTF8STDSTR( _( "Include the border and title block" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_NO_X2 )
.help( UTF8STDSTR( _( "Do not use the extended X2 format" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_NO_NETLIST )
.help( UTF8STDSTR( _( "Do not generate netlist attributes" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_SUBTRACT_SOLDERMASK )
.help( UTF8STDSTR( _( "Subtract soldermask from silkscreen" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_DISABLE_APERTURE_MACROS )
.help( UTF8STDSTR( _( "Disable aperture macros" ) ) )
@ -77,8 +71,7 @@ CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND( const std::string& aN
m_argParser.add_argument( ARG_USE_DRILL_FILE_ORIGIN )
.help( UTF8STDSTR( _( "Use drill/place file origin" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_PRECISION )
.help( UTF8STDSTR( _( "Precision of Gerber coordinates, valid options: 5 or 6" ) ) )
@ -88,8 +81,7 @@ CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND( const std::string& aN
m_argParser.add_argument( ARG_NO_PROTEL_EXTENSION )
.help( UTF8STDSTR( _( "Use KiCad Gerber file extension" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}

View File

@ -54,8 +54,7 @@ CLI::PCB_EXPORT_GERBERS_COMMAND::PCB_EXPORT_GERBERS_COMMAND() :
m_argParser.add_argument( ARG_USE_BOARD_PLOT_PARAMS )
.help( UTF8STDSTR( _( "Use the Gerber plot settings already configured in the "
"board file" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}

View File

@ -44,33 +44,27 @@ CLI::PCB_EXPORT_PDF_COMMAND::PCB_EXPORT_PDF_COMMAND() : PCB_EXPORT_BASE_COMMAND(
m_argParser.add_argument( "-m", ARG_MIRROR )
.help( UTF8STDSTR( _( "Mirror the board (useful for trying to show bottom layers)" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "--erd", ARG_EXCLUDE_REFDES )
.help( UTF8STDSTR( _( "Exclude the reference designator text" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "--ev", ARG_EXCLUDE_VALUE )
.help( UTF8STDSTR( _( "Exclude the value text" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "--ibt", ARG_INCLUDE_BORDER_TITLE )
.help( UTF8STDSTR( _( "Include the border and title block" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_NEGATIVE_SHORT, ARG_NEGATIVE )
.help( UTF8STDSTR( _( ARG_NEGATIVE_DESC ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_BLACKANDWHITE )
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "-t", ARG_THEME )
.default_value( std::string() )

View File

@ -64,35 +64,29 @@ CLI::PCB_EXPORT_POS_COMMAND::PCB_EXPORT_POS_COMMAND() : PCB_EXPORT_BASE_COMMAND(
m_argParser.add_argument( ARG_NEGATE_BOTTOM_X )
.help( UTF8STDSTR( _( "Use negative X coordinates for footprints on bottom layer "
"(ascii or csv formats only)" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_USE_DRILL_FILE_ORIGIN )
.help( UTF8STDSTR( _( "Use drill/place file origin (ascii or csv only)" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_SMD_ONLY )
.help( UTF8STDSTR( _( "Include only SMD footprints (ascii or csv only)" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_EXCLUDE_FOOTPRINTS_TH )
.help( UTF8STDSTR(
_( "Exclude all footprints with through-hole pads (ascii or csv only)" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_EXCLUDE_DNP )
.help( UTF8STDSTR(
_( "Exclude all footprints with the Do Not Populate flag set" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_GERBER_BOARD_EDGE )
.help( UTF8STDSTR( _( "Include board edge layer (Gerber only)" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}

View File

@ -47,8 +47,7 @@ CLI::PCB_EXPORT_SVG_COMMAND::PCB_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND(
m_argParser.add_argument( "-m", ARG_MIRROR )
.help( UTF8STDSTR( _( "Mirror the board (useful for trying to show bottom layers)" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( "-t", ARG_THEME )
.default_value( std::string() )
@ -57,13 +56,11 @@ CLI::PCB_EXPORT_SVG_COMMAND::PCB_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND(
m_argParser.add_argument( ARG_NEGATIVE_SHORT, ARG_NEGATIVE )
.help( UTF8STDSTR( _( ARG_NEGATIVE_DESC ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_BLACKANDWHITE )
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_PAGE_SIZE )
.help( UTF8STDSTR( _( "Set page sizing mode (0 = page with frame and title block, 1 = "
@ -74,8 +71,7 @@ CLI::PCB_EXPORT_SVG_COMMAND::PCB_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND(
m_argParser.add_argument( ARG_EXCLUDE_DRAWING_SHEET )
.help( UTF8STDSTR( _( "No drawing sheet" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_DRILL_SHAPE_OPTION )
.help( UTF8STDSTR( _( "Set pad/via drill shape option (0 = no shape, 1 = "

View File

@ -57,14 +57,12 @@ CLI::SCH_ERC_COMMAND::SCH_ERC_COMMAND() : COMMAND( "erc" )
m_argParser.add_argument( ARG_SEVERITY_ALL )
.help( UTF8STDSTR( _( "Report all ERC violations, this is equivalent to including "
"all the other severity arguments" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_SEVERITY_ERROR )
.help( UTF8STDSTR( _( "Report all ERC error level violations, this can be combined "
"with the other severity arguments" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_SEVERITY_WARNING )
.help( UTF8STDSTR( _( "Report all ERC warning level violations, this can be combined "
@ -75,13 +73,11 @@ CLI::SCH_ERC_COMMAND::SCH_ERC_COMMAND() : COMMAND( "erc" )
m_argParser.add_argument( ARG_SEVERITY_EXCLUSIONS )
.help( UTF8STDSTR( _( "Report all excluded ERC violations, this can be combined "
"with the other severity arguments" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_EXIT_CODE_VIOLATIONS )
.help( UTF8STDSTR( _( "Return a nonzero exit code if ERC violations exist" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}

View File

@ -79,8 +79,7 @@ CLI::SCH_EXPORT_BOM_COMMAND::SCH_EXPORT_BOM_COMMAND() : COMMAND( "bom" )
m_argParser.add_argument( ARG_EXCLUDE_DNP )
.help( UTF8STDSTR( _( ARG_EXCLUDE_DNP_DESC ) ) )
.implicit_value( true )
.default_value( false );
.flag();
// Output formatting options
m_argParser.add_argument( ARG_FIELD_DELIMITER )
@ -105,13 +104,11 @@ CLI::SCH_EXPORT_BOM_COMMAND::SCH_EXPORT_BOM_COMMAND() : COMMAND( "bom" )
m_argParser.add_argument( ARG_KEEP_TABS )
.help( UTF8STDSTR( _( ARG_KEEP_TABS_DESC ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_KEEP_LINE_BREAKS )
.help( UTF8STDSTR( _( ARG_KEEP_LINE_BREAKS_DESC ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}

View File

@ -66,8 +66,7 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
.metavar( "THEME_NAME" );
m_argParser.add_argument( "-b", ARG_BLACKANDWHITE )
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}
m_argParser.add_argument( "-e", ARG_EXCLUDE_DRAWING_SHEET )
@ -79,8 +78,7 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
{
m_argParser.add_argument( ARG_EXCLUDE_PDF_PROPERTY_POPUPS )
.help( UTF8STDSTR( _( "Do not generate property popups in PDF" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}
if( aPlotFormat == SCH_PLOT_FORMAT::PDF
@ -89,8 +87,7 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
{
m_argParser.add_argument( "-n", ARG_NO_BACKGROUND_COLOR )
.help( UTF8STDSTR( _( "Avoid setting a background color (regardless of theme)" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}
m_argParser.add_argument( "-p", ARG_PAGES )

View File

@ -56,18 +56,15 @@ CLI::SYM_EXPORT_SVG_COMMAND::SYM_EXPORT_SVG_COMMAND() : COMMAND( "svg" )
m_argParser.add_argument( ARG_BLACKANDWHITE )
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_INC_HIDDEN_PINS )
.help( UTF8STDSTR( _( "Include hidden pins" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
m_argParser.add_argument( ARG_INC_HIDDEN_FIELDS )
.help( UTF8STDSTR( _( "Include hidden fields" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}

View File

@ -42,8 +42,7 @@ CLI::SYM_UPGRADE_COMMAND::SYM_UPGRADE_COMMAND() : COMMAND( "upgrade" )
m_argParser.add_argument( ARG_FORCE )
.help( UTF8STDSTR(
_( "Forces the symbol library to be resaved regardless of versioning" ) ) )
.implicit_value( true )
.default_value( false );
.flag();
}