Some small reorg of the cli class base

This commit is contained in:
Marek Roszko 2023-08-31 18:43:32 -04:00
parent 27048ad4d2
commit df0c220f2b
29 changed files with 152 additions and 74 deletions

View File

@ -48,13 +48,23 @@ void CLI::COMMAND::PrintHelp()
int CLI::COMMAND::Perform( KIWAY& aKiway )
{
if( m_argParser[ARG_HELP] == true )
if( m_argParser[ ARG_HELP ] == true )
{
PrintHelp();
return 0;
}
if ( m_hasInputArg )
{
m_argInput = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
}
if( m_hasOutputArg )
{
m_argOutput = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
}
return doPerform( aKiway );
}
@ -65,4 +75,33 @@ int CLI::COMMAND::doPerform( KIWAY& aKiway )
PrintHelp();
return EXIT_CODES::OK;
}
void CLI::COMMAND::addCommonArgs( bool aInput, bool aOutput, bool aOutputIsDir )
{
m_hasInputArg = aInput;
m_hasOutputArg = aOutput;
m_outputArgExpectsDir = aOutputIsDir;
if( aInput )
{
m_argParser.add_argument( ARG_INPUT ).help( UTF8STDSTR( _( "Input file" ) ) );
}
if( aOutput )
{
if( aOutputIsDir )
{
m_argParser.add_argument( "-o", ARG_OUTPUT )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Output directory" ) ) );
}
else
{
m_argParser.add_argument( "-o", ARG_OUTPUT )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Output file name" ) ) );
}
}
}

View File

@ -30,6 +30,8 @@
#define ARG_HELP "--help"
#define ARG_HELP_SHORT "-h"
#define ARG_HELP_DESC _( "shows help message and exits" )
#define ARG_OUTPUT "--output"
#define ARG_INPUT "input"
namespace CLI
{
@ -55,7 +57,17 @@ public:
const std::string& GetName() const { return m_name; }
void PrintHelp();
protected:
/**
* Sets up the most common of args used across cli
*
* @param aInput Configures the input arg
* @param aOutput Configures the output arg
* @param aOutputIsDir Configures whether the output arg description will be for a file or directory
*/
void addCommonArgs( bool aInput, bool aOutput, bool aOutputIsDir );
/**
* The internal handler that should be overloaded to implement command specific
* processing and work.
@ -64,8 +76,37 @@ protected:
*/
virtual int doPerform( KIWAY& aKiway );
/**
* Name of this command that is exported and used in the cli
*/
std::string m_name;
argparse::ArgumentParser m_argParser;
/**
* Whether or not the input arg was added for parsing
*/
bool m_hasInputArg;
/**
* Whether or not the output arg was added for parsing
*/
bool m_hasOutputArg;
/**
* Whether or not the output arg is expecting a directory
*/
bool m_outputArgExpectsDir;
/**
* Value of the common input arg if configured
*/
wxString m_argInput;
/**
* Value of the output arg if configured
*/
wxString m_argOutput;
};
}

View File

@ -60,8 +60,8 @@ int CLI::FP_EXPORT_SVG_COMMAND::doPerform( KIWAY& aKiway )
std::unique_ptr<JOB_FP_EXPORT_SVG> svgJob = std::make_unique<JOB_FP_EXPORT_SVG>( true );
svgJob->m_libraryPath = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
svgJob->m_outputDirectory = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
svgJob->m_libraryPath = m_argInput;
svgJob->m_outputDirectory = m_argOutput;
svgJob->m_blackAndWhite = m_argParser.get<bool>( ARG_BLACKANDWHITE );
svgJob->m_footprint = FROM_UTF8( m_argParser.get<std::string>( ARG_FOOTPRINT ).c_str() );

View File

@ -46,8 +46,8 @@ int CLI::FP_UPGRADE_COMMAND::doPerform( KIWAY& aKiway )
{
std::unique_ptr<JOB_FP_UPGRADE> fpJob = std::make_unique<JOB_FP_UPGRADE>( true );
fpJob->m_libraryPath = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
fpJob->m_outputLibraryPath = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
fpJob->m_libraryPath = m_argInput;
fpJob->m_outputLibraryPath = m_argOutput;
fpJob->m_force = m_argParser.get<bool>( ARG_FORCE );
if( !wxDir::Exists( fpJob->m_libraryPath ) )

View File

@ -37,8 +37,10 @@
#define ARG_SEVERITY_EXCLUSIONS "--severity-exclusions"
#define ARG_EXIT_CODE_VIOLATIONS "--exit-code-violations"
CLI::PCB_DRC_COMMAND::PCB_DRC_COMMAND() : PCB_EXPORT_BASE_COMMAND( "drc" )
CLI::PCB_DRC_COMMAND::PCB_DRC_COMMAND() : COMMAND( "drc" )
{
addCommonArgs( true, true, false );
m_argParser.add_description( UTF8STDSTR( _( "Runs the Design Rules Check (DRC) on the PCB and creates a report" ) ) );
m_argParser.add_argument( ARG_FORMAT )
@ -90,8 +92,8 @@ int CLI::PCB_DRC_COMMAND::doPerform( KIWAY& aKiway )
{
std::unique_ptr<JOB_PCB_DRC> drcJob( new JOB_PCB_DRC( true ) );
drcJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
drcJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
drcJob->m_outputFile = m_argOutput;
drcJob->m_filename = m_argInput;
drcJob->m_reportAllTrackErrors = m_argParser.get<bool>( ARG_ALL_TRACK_ERRORS );
drcJob->m_exitCodeViolations = m_argParser.get<bool>( ARG_EXIT_CODE_VIOLATIONS );

View File

@ -25,7 +25,7 @@
namespace CLI
{
class PCB_DRC_COMMAND : public PCB_EXPORT_BASE_COMMAND
class PCB_DRC_COMMAND : public COMMAND
{
public:
PCB_DRC_COMMAND();

View File

@ -164,8 +164,8 @@ int CLI::PCB_EXPORT_3D_COMMAND::doPerform( KIWAY& aKiway )
}
step->m_overwrite = m_argParser.get<bool>( ARG_FORCE );
step->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
step->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
step->m_filename = m_argInput;
step->m_outputFile = m_argOutput;
step->m_format = m_format;
if( step->m_format == JOB_EXPORT_PCB_3D::FORMAT::UNKNOWN )

View File

@ -36,20 +36,7 @@ CLI::PCB_EXPORT_BASE_COMMAND::PCB_EXPORT_BASE_COMMAND( const std::string& aName,
m_requireLayers = false;
m_hasLayerArg = false;
if( aOutputIsDir )
{
m_argParser.add_argument( "-o", ARG_OUTPUT )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Output directory:" ) ) ); // todo fix after string freeze in v8
}
else
{
m_argParser.add_argument( "-o", ARG_OUTPUT )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Output file name" ) ) );
}
m_argParser.add_argument( ARG_INPUT ).help( UTF8STDSTR( _( "Input file" ) ) );
addCommonArgs( true, true, aOutputIsDir );
// Build list of layer names and their layer mask:
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )

View File

@ -26,9 +26,6 @@
namespace CLI
{
#define ARG_OUTPUT "--output"
#define ARG_INPUT "input"
#define ARG_BLACKANDWHITE "--black-and-white"
#define ARG_BLACKANDWHITE_DESC "Black and white only"

View File

@ -97,8 +97,8 @@ int CLI::PCB_EXPORT_DRILL_COMMAND::doPerform( KIWAY& aKiway )
{
std::unique_ptr<JOB_EXPORT_PCB_DRILL> drillJob( new JOB_EXPORT_PCB_DRILL( true ) );
drillJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
drillJob->m_outputDir = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
drillJob->m_filename = m_argInput;
drillJob->m_outputDir = m_argOutput;
if( !drillJob->m_outputDir.IsEmpty() )
{

View File

@ -66,8 +66,8 @@ int CLI::PCB_EXPORT_DXF_COMMAND::doPerform( KIWAY& aKiway )
std::unique_ptr<JOB_EXPORT_PCB_DXF> dxfJob( new JOB_EXPORT_PCB_DXF( true ) );
dxfJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
dxfJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
dxfJob->m_filename = m_argInput;
dxfJob->m_outputFile = m_argOutput;
if( !wxFile::Exists( dxfJob->m_filename ) )
{

View File

@ -97,8 +97,8 @@ CLI::PCB_EXPORT_GERBER_COMMAND::PCB_EXPORT_GERBER_COMMAND() : PCB_EXPORT_GERBER_
int CLI::PCB_EXPORT_GERBER_COMMAND::populateJob( JOB_EXPORT_PCB_GERBER* aJob )
{
aJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
aJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
aJob->m_filename = m_argInput;
aJob->m_outputFile = m_argOutput;
aJob->m_plotFootprintValues = !m_argParser.get<bool>( ARG_EXCLUDE_VALUE );
aJob->m_plotRefDes = !m_argParser.get<bool>( ARG_EXCLUDE_REFDES );

View File

@ -88,8 +88,8 @@ int CLI::PCB_EXPORT_PDF_COMMAND::doPerform( KIWAY& aKiway )
std::unique_ptr<JOB_EXPORT_PCB_PDF> pdfJob( new JOB_EXPORT_PCB_PDF( true ) );
pdfJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
pdfJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
pdfJob->m_filename = m_argInput;
pdfJob->m_outputFile = m_argOutput;
if( !wxFile::Exists( pdfJob->m_filename ) )
{

View File

@ -100,8 +100,8 @@ int CLI::PCB_EXPORT_POS_COMMAND::doPerform( KIWAY& aKiway )
std::unique_ptr<JOB_EXPORT_PCB_POS> aPosJob( new JOB_EXPORT_PCB_POS( true ) );
aPosJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
aPosJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
aPosJob->m_filename = m_argInput;
aPosJob->m_outputFile = m_argOutput;
if( !wxFile::Exists( aPosJob->m_filename ) )
{

View File

@ -92,8 +92,8 @@ int CLI::PCB_EXPORT_SVG_COMMAND::doPerform( KIWAY& aKiway )
svgJob->m_negative = m_argParser.get<bool>( ARG_NEGATIVE );
svgJob->m_drillShapeOption = m_argParser.get<int>( ARG_DRILL_SHAPE_OPTION );
svgJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
svgJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
svgJob->m_filename = m_argInput;
svgJob->m_outputFile = m_argOutput;
svgJob->m_colorTheme = FROM_UTF8( m_argParser.get<std::string>( ARG_THEME ).c_str() );
svgJob->m_plotDrawingSheet = !m_argParser.get<bool>( ARG_EXCLUDE_DRAWING_SHEET );

View File

@ -36,8 +36,10 @@
#define ARG_SEVERITY_EXCLUSIONS "--severity-exclusions"
#define ARG_EXIT_CODE_VIOLATIONS "--exit-code-violations"
CLI::SCH_ERC_COMMAND::SCH_ERC_COMMAND() : PCB_EXPORT_BASE_COMMAND( "erc" )
CLI::SCH_ERC_COMMAND::SCH_ERC_COMMAND() : COMMAND( "erc" )
{
addCommonArgs( true, true, false );
m_argParser.add_description( UTF8STDSTR( _( "Runs the Electrical Rules Check (ERC) on the schematic and creates a report" ) ) );
m_argParser.add_argument( ARG_FORMAT )
@ -84,8 +86,8 @@ int CLI::SCH_ERC_COMMAND::doPerform( KIWAY& aKiway )
{
std::unique_ptr<JOB_SCH_ERC> ercJob( new JOB_SCH_ERC( true ) );
ercJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
ercJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
ercJob->m_outputFile = m_argOutput;
ercJob->m_filename = m_argInput;
ercJob->m_exitCodeViolations = m_argParser.get<bool>( ARG_EXIT_CODE_VIOLATIONS );
if( m_argParser.get<bool>( ARG_SEVERITY_ALL ) )

View File

@ -25,7 +25,7 @@
namespace CLI
{
class SCH_ERC_COMMAND : public PCB_EXPORT_BASE_COMMAND
class SCH_ERC_COMMAND : public COMMAND
{
public:
SCH_ERC_COMMAND();

View File

@ -29,8 +29,10 @@
#include <macros.h>
CLI::SCH_EXPORT_BOM_COMMAND::SCH_EXPORT_BOM_COMMAND() : PCB_EXPORT_BASE_COMMAND( "bom" )
CLI::SCH_EXPORT_BOM_COMMAND::SCH_EXPORT_BOM_COMMAND() : COMMAND( "bom" )
{
addCommonArgs( true, true, false );
// Field output options
m_argParser.add_argument( ARG_FIELDS )
.help( UTF8STDSTR( _( ARG_FIELDS_DESC ) ) )
@ -111,8 +113,8 @@ int CLI::SCH_EXPORT_BOM_COMMAND::doPerform( KIWAY& aKiway )
std::unique_ptr<JOB_EXPORT_SCH_BOM> bomJob = std::make_unique<JOB_EXPORT_SCH_BOM>( true );
// Basic options
bomJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
bomJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
bomJob->m_filename = m_argInput;
bomJob->m_outputFile = m_argOutput;
// Format options
bomJob->m_fieldDelimiter =

View File

@ -67,7 +67,7 @@ namespace CLI
#define ARG_EXCLUDE_DNP "--exclude-dnp"
#define ARG_EXCLUDE_DNP_DESC "Exclude symbols marked Do-Not-Populate."
class SCH_EXPORT_BOM_COMMAND : public PCB_EXPORT_BASE_COMMAND
class SCH_EXPORT_BOM_COMMAND : public COMMAND
{
public:
SCH_EXPORT_BOM_COMMAND();

View File

@ -29,8 +29,10 @@
#define ARG_FORMAT "--format"
CLI::SCH_EXPORT_NETLIST_COMMAND::SCH_EXPORT_NETLIST_COMMAND() : PCB_EXPORT_BASE_COMMAND( "netlist" )
CLI::SCH_EXPORT_NETLIST_COMMAND::SCH_EXPORT_NETLIST_COMMAND() : COMMAND( "netlist" )
{
addCommonArgs( true, true, false );
m_argParser.add_argument( ARG_FORMAT )
.default_value( std::string( "kicadsexpr" ) )
.help( UTF8STDSTR( _( "Netlist output format, valid options: kicadsexpr, kicadxml, cadstar, orcadpcb2, spice, spicemodel" ) ) );
@ -42,8 +44,8 @@ int CLI::SCH_EXPORT_NETLIST_COMMAND::doPerform( KIWAY& aKiway )
std::unique_ptr<JOB_EXPORT_SCH_NETLIST> netJob =
std::make_unique<JOB_EXPORT_SCH_NETLIST>( true );
netJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
netJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
netJob->m_filename = m_argInput;
netJob->m_outputFile = m_argOutput;
if( !wxFile::Exists( netJob->m_filename ) )
{

View File

@ -25,7 +25,7 @@
namespace CLI
{
class SCH_EXPORT_NETLIST_COMMAND : public PCB_EXPORT_BASE_COMMAND
class SCH_EXPORT_NETLIST_COMMAND : public COMMAND
{
public:
SCH_EXPORT_NETLIST_COMMAND();

View File

@ -43,9 +43,11 @@ const HPGL_PLOT_ORIGIN_AND_UNITS hpgl_origin_ops[4] = {
CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
PLOT_FORMAT aPlotFormat,
bool aOutputIsDir ) :
PCB_EXPORT_BASE_COMMAND( aName, aOutputIsDir ),
m_plotFormat( aPlotFormat ), m_useDir( aOutputIsDir )
COMMAND( aName ),
m_plotFormat( aPlotFormat )
{
addCommonArgs( true, true, aOutputIsDir );
m_argParser.add_argument( "-t", ARG_THEME )
.default_value( std::string() )
.help( UTF8STDSTR( _( "Color theme to use (will default to schematic settings)" ) ) );
@ -88,7 +90,7 @@ CLI::SCH_EXPORT_PLOT_COMMAND::SCH_EXPORT_PLOT_COMMAND( const std::string& aName,
int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway )
{
wxString filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
wxString filename = m_argInput;
if( !wxFile::Exists( filename ) )
{
wxFprintf( stderr, _( "Schematic file does not exist or is not accessible\n" ) );
@ -105,11 +107,10 @@ int CLI::SCH_EXPORT_PLOT_COMMAND::doPerform( KIWAY& aKiway )
settings.m_pageSizeSelect = PAGE_SIZE_AUTO;
settings.m_useBackgroundColor = !m_argParser.get<bool>( ARG_NO_BACKGROUND_COLOR );
settings.m_theme = FROM_UTF8( m_argParser.get<std::string>( ARG_THEME ).c_str() );
if( m_useDir )
settings.m_outputDirectory =
FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
if( m_outputArgExpectsDir )
settings.m_outputDirectory = m_argOutput;
else
settings.m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
settings.m_outputFile = m_argOutput;
// HPGL local options
if( m_plotFormat == PLOT_FORMAT::HPGL )
{

View File

@ -26,14 +26,13 @@
namespace CLI
{
class SCH_EXPORT_PLOT_COMMAND : public PCB_EXPORT_BASE_COMMAND
class SCH_EXPORT_PLOT_COMMAND : public COMMAND
{
public:
SCH_EXPORT_PLOT_COMMAND( const std::string& aName, PLOT_FORMAT aPlotFormat,
bool aOutputIsDir = true );
PLOT_FORMAT m_plotFormat;
bool m_useDir;
protected:
int doPerform( KIWAY& aKiway ) override;

View File

@ -29,8 +29,10 @@
CLI::SCH_EXPORT_PYTHONBOM_COMMAND::SCH_EXPORT_PYTHONBOM_COMMAND() :
PCB_EXPORT_BASE_COMMAND( "python-bom" )
{
COMMAND( "python-bom" )
{
addCommonArgs( true, true, false );
m_argParser.add_description( UTF8STDSTR( _( "Export the legacy bom xml format used in the "
"schematic editor with python scripts" ) ) );
}
@ -41,8 +43,8 @@ int CLI::SCH_EXPORT_PYTHONBOM_COMMAND::doPerform( KIWAY& aKiway )
std::unique_ptr<JOB_EXPORT_SCH_PYTHONBOM> bomJob =
std::make_unique<JOB_EXPORT_SCH_PYTHONBOM>( true );
bomJob->m_filename = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
bomJob->m_outputFile = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
bomJob->m_filename = m_argInput;
bomJob->m_outputFile = m_argOutput;
if( !wxFile::Exists( bomJob->m_filename ) )
{

View File

@ -25,7 +25,7 @@
namespace CLI
{
class SCH_EXPORT_PYTHONBOM_COMMAND : public PCB_EXPORT_BASE_COMMAND
class SCH_EXPORT_PYTHONBOM_COMMAND : public COMMAND
{
public:
SCH_EXPORT_PYTHONBOM_COMMAND();

View File

@ -33,8 +33,10 @@
#define ARG_INC_HIDDEN_PINS "--include-hidden-pins"
#define ARG_INC_HIDDEN_FIELDS "--include-hidden-fields"
CLI::SYM_EXPORT_SVG_COMMAND::SYM_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND( "svg" )
CLI::SYM_EXPORT_SVG_COMMAND::SYM_EXPORT_SVG_COMMAND() : COMMAND( "svg" )
{
addCommonArgs( true, true, false );
m_argParser.add_description( UTF8STDSTR( _( "Exports the symbol or entire symbol library to SVG" ) ) );
m_argParser.add_argument( "-t", ARG_THEME )
@ -66,8 +68,8 @@ int CLI::SYM_EXPORT_SVG_COMMAND::doPerform( KIWAY& aKiway )
{
std::unique_ptr<JOB_SYM_EXPORT_SVG> svgJob = std::make_unique<JOB_SYM_EXPORT_SVG>( true );
svgJob->m_libraryPath = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
svgJob->m_outputDirectory = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
svgJob->m_libraryPath = m_argInput;
svgJob->m_outputDirectory = m_argOutput;
svgJob->m_blackAndWhite = m_argParser.get<bool>( ARG_BLACKANDWHITE );
svgJob->m_symbol = FROM_UTF8( m_argParser.get<std::string>( ARG_SYMBOL ).c_str() );
svgJob->m_includeHiddenFields = m_argParser.get<bool>( ARG_INC_HIDDEN_FIELDS );

View File

@ -25,7 +25,7 @@
namespace CLI
{
class SYM_EXPORT_SVG_COMMAND : public PCB_EXPORT_BASE_COMMAND
class SYM_EXPORT_SVG_COMMAND : public COMMAND
{
public:
SYM_EXPORT_SVG_COMMAND();

View File

@ -30,8 +30,10 @@
#define ARG_FORCE "--force"
CLI::SYM_UPGRADE_COMMAND::SYM_UPGRADE_COMMAND() : PCB_EXPORT_BASE_COMMAND( "upgrade" )
CLI::SYM_UPGRADE_COMMAND::SYM_UPGRADE_COMMAND() : COMMAND( "upgrade" )
{
addCommonArgs( true, true, false );
m_argParser.add_description( UTF8STDSTR( _( "Upgrades the symbol library to the current kicad version format" ) ) );
m_argParser.add_argument( ARG_FORCE )
@ -46,8 +48,8 @@ int CLI::SYM_UPGRADE_COMMAND::doPerform( KIWAY& aKiway )
{
std::unique_ptr<JOB_SYM_UPGRADE> symJob = std::make_unique<JOB_SYM_UPGRADE>( true );
symJob->m_libraryPath = FROM_UTF8( m_argParser.get<std::string>( ARG_INPUT ).c_str() );
symJob->m_outputLibraryPath = FROM_UTF8( m_argParser.get<std::string>( ARG_OUTPUT ).c_str() );
symJob->m_libraryPath = m_argInput;
symJob->m_outputLibraryPath = m_argOutput;
symJob->m_force = m_argParser.get<bool>( ARG_FORCE );
if( !wxFile::Exists( symJob->m_libraryPath ) )

View File

@ -25,7 +25,7 @@
namespace CLI
{
class SYM_UPGRADE_COMMAND : public PCB_EXPORT_BASE_COMMAND
class SYM_UPGRADE_COMMAND : public COMMAND
{
public:
SYM_UPGRADE_COMMAND();