Sprinkle metavars into cli descriptions

This commit is contained in:
Marek Roszko 2023-08-31 22:01:07 -04:00
parent f357e79f77
commit 270c195df9
17 changed files with 92 additions and 42 deletions

View File

@ -114,7 +114,9 @@ void CLI::COMMAND::addCommonArgs( bool aInput, bool aOutput, bool aOutputIsDir )
if( aInput )
{
m_argParser.add_argument( ARG_INPUT ).help( UTF8STDSTR( _( "Input file" ) ) );
m_argParser.add_argument( ARG_INPUT )
.help( UTF8STDSTR( _( "Input file" ) ) )
.metavar( "INPUT_FILE" );
}
if( aOutput )
@ -123,13 +125,15 @@ void CLI::COMMAND::addCommonArgs( bool aInput, bool aOutput, bool aOutputIsDir )
{
m_argParser.add_argument( "-o", ARG_OUTPUT )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Output directory" ) ) );
.help( UTF8STDSTR( _( "Output directory" ) ) )
.metavar( "OUTPUT_DIR" );
}
else
{
m_argParser.add_argument( "-o", ARG_OUTPUT )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Output file name" ) ) );
.help( UTF8STDSTR( _( "Output file name" ) ) )
.metavar( "OUTPUT_FILE" );
}
}
}
@ -141,7 +145,8 @@ void CLI::COMMAND::addDrawingSheetArg()
m_argParser.add_argument( ARG_DRAWING_SHEET )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Path to drawing sheet, this overrides any existing project defined sheet when used" ) ) );
.help( UTF8STDSTR( _( "Path to drawing sheet, this overrides any existing project defined sheet when used" ) ) )
.metavar( "SHEET_PATH" );
}
@ -153,5 +158,6 @@ void CLI::COMMAND::addDefineArg()
.default_value( std::vector<std::string>() )
.help( UTF8STDSTR(
_( "Overrides or adds project variables, can be used multiple times to declare "
"multiple variables. Use in the format of '--define-var key=value'" ) ) );
"multiple variables. Use in the format of '--define-var key=value' or '-D key=value'" ) ) )
.metavar( "KEY=VALUE" );
}

View File

@ -29,7 +29,7 @@
#define ARG_VERSION "--version"
#define ARG_HELP "--help"
#define ARG_HELP_SHORT "-h"
#define ARG_HELP_DESC _( "shows help message and exits" )
#define ARG_HELP_DESC _( "Shows help message and exits" )
#define ARG_OUTPUT "--output"
#define ARG_INPUT "input"
#define ARG_DRAWING_SHEET "--drawing-sheet"

View File

@ -44,7 +44,8 @@ CLI::FP_EXPORT_SVG_COMMAND::FP_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND( "
m_argParser.add_argument( "--fp", ARG_FOOTPRINT )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Specific symbol to export within the library" ) ) );
.help( UTF8STDSTR( _( "Specific footprint to export within the library" ) ) )
.metavar( "FOOTPRINT_NAME" );
m_argParser.add_argument( ARG_BLACKANDWHITE )
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )

View File

@ -46,7 +46,8 @@ CLI::PCB_DRC_COMMAND::PCB_DRC_COMMAND() : COMMAND( "drc" )
m_argParser.add_argument( ARG_FORMAT )
.default_value( std::string( "report" ) )
.help( UTF8STDSTR( _( "Output file format, options: json, report" ) ) );
.help( UTF8STDSTR( _( "Output file format, options: json, report" ) ) )
.metavar( "FORMAT" );
m_argParser.add_argument( ARG_ALL_TRACK_ERRORS )
.help( UTF8STDSTR( _( "Report all errors for each track" ) ) )
@ -55,8 +56,8 @@ CLI::PCB_DRC_COMMAND::PCB_DRC_COMMAND() : COMMAND( "drc" )
m_argParser.add_argument( ARG_UNITS )
.default_value( std::string( "mm" ) )
.help( UTF8STDSTR(
_( "Report units; valid options: in, mm, mils" ) ) );
.help( UTF8STDSTR( _( "Report units; valid options: in, mm, mils" ) ) )
.metavar( "UNITS" );
m_argParser.add_argument( ARG_SEVERITY_ALL )
.help( UTF8STDSTR( _( "Report all DRC violations, this is equivalent to including all the other severity arguments" ) ) )

View File

@ -115,7 +115,8 @@ CLI::PCB_EXPORT_3D_COMMAND::PCB_EXPORT_3D_COMMAND( const std::string& aName,
m_argParser.add_argument( ARG_MIN_DISTANCE )
.default_value( std::string( "0.01mm" ) )
.help( UTF8STDSTR(
_( "Minimum distance between points to treat them as separate ones" ) ) );
_( "Minimum distance between points to treat them as separate ones" ) ) )
.metavar( "MIN_DIST" );
}
m_argParser.add_argument( ARG_USER_ORIGIN )

View File

@ -112,7 +112,8 @@ void CLI::PCB_EXPORT_BASE_COMMAND::addLayerArg( bool aRequire )
.default_value( std::string() )
.help( UTF8STDSTR(
_( "Comma separated list of untranslated layer names to include such as "
"F.Cu,B.Cu" ) ) );
"F.Cu,B.Cu" ) ) )
.metavar( "LAYER_LIST" );
m_hasLayerArg = true;
m_requireLayers = aRequire;

View File

@ -42,26 +42,33 @@
CLI::PCB_EXPORT_DRILL_COMMAND::PCB_EXPORT_DRILL_COMMAND() : PCB_EXPORT_BASE_COMMAND( "drill" )
{
m_argParser.add_description( UTF8STDSTR( _( "Generate Drill Files" ) ) );
m_argParser.add_argument( ARG_FORMAT )
.default_value( std::string( "excellon" ) )
.help( UTF8STDSTR( _( "Valid options excellon, gerber." ) ) );
.help( UTF8STDSTR( _( "Valid options excellon, gerber." ) ) )
.metavar( "FORMAT" );
m_argParser.add_argument( ARG_DRILL_ORIGIN )
.default_value( std::string( "absolute" ) )
.help( UTF8STDSTR( _( "Valid options are: absolute,plot" ) ) );
.help( UTF8STDSTR( _( "Valid options are: absolute,plot" ) ) )
.metavar( "DRILL_ORIGIN" );
m_argParser.add_argument( ARG_EXCELLON_ZEROS_FORMAT )
.default_value( std::string( "decimal" ) )
.help( UTF8STDSTR(
_( "Valid options are: decimal,suppressleading,suppresstrailing,keep." ) ) );
_( "Valid options are: decimal,suppressleading,suppresstrailing,keep." ) ) )
.metavar( "ZEROS_FORMAT" );
m_argParser.add_argument( ARG_EXCELLON_OVAL_FORMAT )
.default_value( std::string( "alternate" ) )
.help( UTF8STDSTR( _( "Valid options are: route,alternate." ) ) );
.help( UTF8STDSTR( _( "Valid options are: route,alternate." ) ) )
.metavar( "OVAL_FORMAT" );
m_argParser.add_argument( "-u", ARG_EXCELLON_UNITS )
.default_value( std::string( "mm" ) )
.help( UTF8STDSTR( _( "Output units, valid options:in,mm" ) ) );
.help( UTF8STDSTR( _( "Output units, valid options:in,mm" ) ) )
.metavar( "UNITS" );
m_argParser.add_argument( ARG_EXCELLON_MIRRORY )
.help( UTF8STDSTR( _( "Mirror Y axis" ) ) )
@ -85,7 +92,8 @@ CLI::PCB_EXPORT_DRILL_COMMAND::PCB_EXPORT_DRILL_COMMAND() : PCB_EXPORT_BASE_COMM
m_argParser.add_argument( ARG_MAP_FORMAT )
.default_value( std::string( "pdf" ) )
.help( UTF8STDSTR( _( "Valid options: pdf,gerberx2,ps,dxf,svg" ) ) );
.help( UTF8STDSTR( _( "Valid options: pdf,gerberx2,ps,dxf,svg" ) ) )
.metavar( "MAP_FORMAT" );
m_argParser.add_argument( ARG_GERBER_PRECISION )
.help( UTF8STDSTR( _( "Precision of gerber coordinates (5 or 6)" ) ) )

View File

@ -35,6 +35,8 @@
CLI::PCB_EXPORT_DXF_COMMAND::PCB_EXPORT_DXF_COMMAND() : PCB_EXPORT_BASE_COMMAND( "dxf" )
{
m_argParser.add_description( UTF8STDSTR( _( "Generate a DXF from a list of layers" ) ) );
addLayerArg( true );
addDrawingSheetArg();
addDefineArg();
@ -61,7 +63,8 @@ CLI::PCB_EXPORT_DXF_COMMAND::PCB_EXPORT_DXF_COMMAND() : PCB_EXPORT_BASE_COMMAND(
m_argParser.add_argument( "--ou", ARG_OUTPUT_UNITS )
.default_value( std::string( "in" ) )
.help( UTF8STDSTR( _( "Output units, valid options: mm, in" ) ) );
.help( UTF8STDSTR( _( "Output units, valid options: mm, in" ) ) )
.metavar( "UNITS" );
}

View File

@ -83,7 +83,8 @@ CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND( const std::string& aN
m_argParser.add_argument( ARG_PRECISION )
.help( UTF8STDSTR( _( "Precision of gerber coordinates, valid options: 5 or 6" ) ) )
.scan<'i', int>()
.default_value( 6 );
.default_value( 6 )
.metavar( "PRECISION" );
m_argParser.add_argument( ARG_NO_PROTEL_EXTENSION )
.help( UTF8STDSTR( _( "Use KiCad gerber file extension" ) ) )

View File

@ -48,7 +48,8 @@ CLI::PCB_EXPORT_GERBERS_COMMAND::PCB_EXPORT_GERBERS_COMMAND() :
.default_value( std::string() )
.help( UTF8STDSTR(
_( "Layers to include on each plot, comma separated list of untranslated layer names to include such as "
"F.Cu,B.Cu" ) ) );
"F.Cu,B.Cu" ) ) )
.metavar( "COMMON_LAYER_LIST" );
m_argParser.add_argument( ARG_USE_BOARD_PLOT_PARAMS )
.help( UTF8STDSTR( _( "Use the gerber plot settings already configured in the board file" ) ) )

View File

@ -35,6 +35,8 @@
CLI::PCB_EXPORT_PDF_COMMAND::PCB_EXPORT_PDF_COMMAND() : PCB_EXPORT_BASE_COMMAND( "pdf" )
{
m_argParser.add_description( UTF8STDSTR( _( "Generate PDF from a list of layers" ) ) );
addLayerArg( true );
addDrawingSheetArg();
addDefineArg();
@ -71,7 +73,8 @@ CLI::PCB_EXPORT_PDF_COMMAND::PCB_EXPORT_PDF_COMMAND() : PCB_EXPORT_BASE_COMMAND(
m_argParser.add_argument( "-t", ARG_THEME )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Color theme to use (will default to PCB Editor settings)" ) ) );
.help( UTF8STDSTR( _( "Color theme to use (will default to PCB Editor settings)" ) ) )
.metavar( "THEME_NAME" );
m_argParser.add_argument( ARG_DRILL_SHAPE_OPTION )
.help( UTF8STDSTR( _( "Set pad/via drill shape option (0 = no shape, 1 = "

View File

@ -51,11 +51,14 @@ CLI::PCB_EXPORT_POS_COMMAND::PCB_EXPORT_POS_COMMAND() : PCB_EXPORT_BASE_COMMAND(
m_argParser.add_argument( ARG_FORMAT )
.default_value( std::string( "ascii" ) )
.help( UTF8STDSTR( _( "Valid options: ascii,csv,gerber" ) ) );
.help( UTF8STDSTR( _( "Valid options: ascii,csv,gerber" ) ) )
.metavar( "FORMAT" );
m_argParser.add_argument( ARG_UNITS )
.default_value( std::string( "in" ) )
.help( UTF8STDSTR( _( "Output units; ascii or csv format only; valid options: in,mm" ) ) );
.help( UTF8STDSTR(
_( "Output units; ascii or csv format only; valid options: in,mm" ) ) )
.metavar( "UNITS" );
m_argParser.add_argument( ARG_NEGATE_BOTTOM_X )
.help( UTF8STDSTR( _( "Use negative X coordinates for footprints on bottom layer "

View File

@ -38,6 +38,8 @@
CLI::PCB_EXPORT_SVG_COMMAND::PCB_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND( "svg" )
{
m_argParser.add_description( UTF8STDSTR( _( "Generate SVG outputs of a given layer list" ) ) );
addLayerArg( true );
addDrawingSheetArg();
addDefineArg();
@ -49,7 +51,8 @@ CLI::PCB_EXPORT_SVG_COMMAND::PCB_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND(
m_argParser.add_argument( "-t", ARG_THEME )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Color theme to use (will default to pcbnew settings)" ) ) );
.help( UTF8STDSTR( _( "Color theme to use (will default to pcbnew settings)" ) ) )
.metavar( "THEME_NAME" );
m_argParser.add_argument( ARG_NEGATIVE_SHORT, ARG_NEGATIVE )
.help( UTF8STDSTR( _( ARG_NEGATIVE_DESC ) ) )
@ -65,7 +68,8 @@ CLI::PCB_EXPORT_SVG_COMMAND::PCB_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND(
.help( UTF8STDSTR( _( "Set page sizing mode (0 = page with frame and title block, 1 = "
"current page size, 2 = board area only)" ) ) )
.scan<'i', int>()
.default_value( 0 );
.default_value( 0 )
.metavar( "MODE" );
m_argParser.add_argument( ARG_EXCLUDE_DRAWING_SHEET )
.help( UTF8STDSTR( _( "No drawing sheet" ) ) )
@ -76,7 +80,8 @@ CLI::PCB_EXPORT_SVG_COMMAND::PCB_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND(
.help( UTF8STDSTR( _( "Set pad/via drill shape option (0 = no shape, 1 = "
"small shape, 2 = actual shape)" ) ) )
.scan<'i', int>()
.default_value( 2 );
.default_value( 2 )
.metavar( "SHAPE_OPTION" );
}

View File

@ -36,19 +36,23 @@ CLI::SCH_EXPORT_BOM_COMMAND::SCH_EXPORT_BOM_COMMAND() : COMMAND( "bom" )
// Field output options
m_argParser.add_argument( ARG_FIELDS )
.help( UTF8STDSTR( _( ARG_FIELDS_DESC ) ) )
.default_value( std::string( "Reference,Value,Footprint,${QUANTITY},${DNP}" ) );
.default_value( std::string( "Reference,Value,Footprint,${QUANTITY},${DNP}" ) )
.metavar( "FIELDS" );
m_argParser.add_argument( ARG_LABELS )
.help( UTF8STDSTR( _( ARG_LABELS_DESC ) ) )
.default_value( std::string( "Refs,Value,Footprint,Qty,DNP" ) );
.default_value( std::string( "Refs,Value,Footprint,Qty,DNP" ) )
.metavar( "LABELS" );
m_argParser.add_argument( ARG_GROUP_BY )
.help( UTF8STDSTR( _( ARG_GROUP_BY_DESC ) ) )
.default_value( std::string( "" ) );
.default_value( std::string( "" ) )
.metavar( "GROUP_BY" );
m_argParser.add_argument( ARG_SORT_FIELD )
.help( UTF8STDSTR( _( ARG_SORT_FIELD_DESC ) ) )
.default_value( std::string( "Reference" ) );
.default_value( std::string( "Reference" ) )
.metavar( "SORT_BY" );
m_argParser.add_argument( ARG_SORT_ASC )
.help( UTF8STDSTR( _( ARG_SORT_ASC_DESC ) ) )
@ -57,7 +61,8 @@ CLI::SCH_EXPORT_BOM_COMMAND::SCH_EXPORT_BOM_COMMAND() : COMMAND( "bom" )
m_argParser.add_argument( ARG_FILTER )
.help( UTF8STDSTR( _( ARG_FILTER_DESC ) ) )
.default_value( std::string( "" ) );
.default_value( std::string( "" ) )
.metavar( "FILTER" );
m_argParser.add_argument( ARG_EXCLUDE_DNP )
.help( UTF8STDSTR( _( ARG_EXCLUDE_DNP_DESC ) ) )
@ -67,19 +72,23 @@ CLI::SCH_EXPORT_BOM_COMMAND::SCH_EXPORT_BOM_COMMAND() : COMMAND( "bom" )
// Output formatting options
m_argParser.add_argument( ARG_FIELD_DELIMITER )
.help( UTF8STDSTR( _( ARG_FIELD_DELIMITER_DESC ) ) )
.default_value( std::string( "," ) );
.default_value( std::string( "," ) )
.metavar( "FIELD_DELIM" );
m_argParser.add_argument( ARG_STRING_DELIMITER )
.help( UTF8STDSTR( _( ARG_STRING_DELIMITER_DESC ) ) )
.default_value( std::string( "\"" ) );
.default_value( std::string( "\"" ) )
.metavar( "STR_DELIM" );
m_argParser.add_argument( ARG_REF_DELIMITER )
.help( UTF8STDSTR( _( ARG_REF_DELIMITER_DESC ) ) )
.default_value( std::string( "," ) );
.default_value( std::string( "," ) )
.metavar( "REF_DELIM" );
m_argParser.add_argument( ARG_REF_RANGE_DELIMITER )
.help( UTF8STDSTR( _( ARG_REF_RANGE_DELIMITER_DESC ) ) )
.default_value( std::string( "-" ) );
.default_value( std::string( "-" ) )
.metavar( "REF_RANGE_DELIM" );
m_argParser.add_argument( ARG_KEEP_TABS )
.help( UTF8STDSTR( _( ARG_KEEP_TABS_DESC ) ) )

View File

@ -35,7 +35,9 @@ CLI::SCH_EXPORT_NETLIST_COMMAND::SCH_EXPORT_NETLIST_COMMAND() : COMMAND( "netlis
m_argParser.add_argument( ARG_FORMAT )
.default_value( std::string( "kicadsexpr" ) )
.help( UTF8STDSTR( _( "Netlist output format, valid options: kicadsexpr, kicadxml, cadstar, orcadpcb2, spice, spicemodel" ) ) );
.help( UTF8STDSTR( _( "Netlist output format, valid options: kicadsexpr, kicadxml, "
"cadstar, orcadpcb2, spice, spicemodel" ) ) )
.metavar( "FORMAT" );
}

View File

@ -52,7 +52,8 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
m_argParser.add_argument( "-t", ARG_THEME )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Color theme to use (will default to schematic settings)" ) ) );
.help( UTF8STDSTR( _( "Color theme to use (will default to schematic settings)" ) ) )
.metavar( "THEME_NAME" );
m_argParser.add_argument( "-b", ARG_BLACKANDWHITE )
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )
@ -79,13 +80,15 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
m_argParser.add_argument( "-p", ARG_HPGL_PEN_SIZE )
.help( UTF8STDSTR( _( "Pen size [mm]" ) ) )
.scan<'g', double>()
.default_value( 0.5 );
.default_value( 0.5 )
.metavar( "PEN_SIZE" );
m_argParser.add_argument( "-r", ARG_HPGL_ORIGIN )
.help( UTF8STDSTR( _( "Origin and scale: 0 bottom left, 1 centered, 2 page fit, 3 "
"content fit" ) ) )
.scan<'d', int>()
.default_value( 1 );
.default_value( 1 )
.metavar( "ORIGIN" );
}
}

View File

@ -41,11 +41,13 @@ CLI::SYM_EXPORT_SVG_COMMAND::SYM_EXPORT_SVG_COMMAND() : COMMAND( "svg" )
m_argParser.add_argument( "-t", ARG_THEME )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Color theme to use (will default to pcbnew settings)" ) ) );
.help( UTF8STDSTR( _( "Color theme to use (will default to pcbnew settings)" ) ) )
.metavar( "THEME_NAME" );
m_argParser.add_argument( "-s", ARG_SYMBOL )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Specific symbol to export within the library" ) ) );
.help( UTF8STDSTR( _( "Specific symbol to export within the library" ) ) )
.metavar( "SYMBOL" );
m_argParser.add_argument( ARG_BLACKANDWHITE )
.help( UTF8STDSTR( _( ARG_BLACKANDWHITE_DESC ) ) )