mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-19 00:21:36 +00:00
Fixes for CLI input and output directories.
Plot functions use an output directory. Those functions that support an input directory also support input files.
This commit is contained in:
parent
567da3de91
commit
9ac851b314
@ -112,7 +112,8 @@ int CLI::COMMAND::doPerform( KIWAY& aKiway )
|
||||
}
|
||||
|
||||
|
||||
void CLI::COMMAND::addCommonArgs( bool aInput, bool aOutput, bool aInputIsDir, bool aOutputIsDir )
|
||||
void CLI::COMMAND::addCommonArgs( bool aInput, bool aOutput, bool aInputCanBeDir,
|
||||
bool aOutputIsDir )
|
||||
{
|
||||
m_hasInputArg = aInput;
|
||||
m_hasOutputArg = aOutput;
|
||||
@ -120,18 +121,16 @@ void CLI::COMMAND::addCommonArgs( bool aInput, bool aOutput, bool aInputIsDir, b
|
||||
|
||||
if( aInput )
|
||||
{
|
||||
if( aInputIsDir )
|
||||
if( aInputCanBeDir )
|
||||
{
|
||||
m_argParser.add_argument( ARG_INPUT )
|
||||
.help( UTF8STDSTR( _( "Input directory" ) ) )
|
||||
.metavar( "INPUT_DIR" );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_argParser.add_argument( ARG_INPUT )
|
||||
.help( UTF8STDSTR( _( "Input file" ) ) )
|
||||
.metavar( "INPUT_FILE" );
|
||||
}
|
||||
|
||||
m_argParser.add_argument( ARG_INPUT )
|
||||
.help( UTF8STDSTR( _( "Input file" ) ) )
|
||||
.metavar( "INPUT_FILE" );
|
||||
}
|
||||
|
||||
if( aOutput )
|
||||
|
@ -67,12 +67,12 @@ protected:
|
||||
*
|
||||
* @param aInput Configures the input arg
|
||||
* @param aOutput Configures the output arg
|
||||
* @param aInputIsDir Configures whether the input arg description will be for a file or
|
||||
* directory
|
||||
* @param aInputCanBeDir Configures whether the input arg description will be for either a
|
||||
* file or directory
|
||||
* @param aOutputIsDir Configures whether the output arg description will be for a file or
|
||||
* directory
|
||||
*/
|
||||
void addCommonArgs( bool aInput, bool aOutput, bool aInputIsDir, bool aOutputIsDir );
|
||||
void addCommonArgs( bool aInput, bool aOutput, bool aInputCanBeDir, bool aOutputIsDir );
|
||||
|
||||
/**
|
||||
* Set up the drawing sheet arg used by many of the export commands
|
||||
|
@ -32,7 +32,8 @@
|
||||
|
||||
#define ARG_FOOTPRINT "--footprint"
|
||||
|
||||
CLI::FP_EXPORT_SVG_COMMAND::FP_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND( "svg", true, true )
|
||||
CLI::FP_EXPORT_SVG_COMMAND::FP_EXPORT_SVG_COMMAND() :
|
||||
PCB_EXPORT_BASE_COMMAND( "svg", true, true )
|
||||
{
|
||||
m_argParser.add_description( UTF8STDSTR( _( "Exports the footprint or entire footprint "
|
||||
"library to SVG" ) ) );
|
||||
|
@ -30,7 +30,8 @@
|
||||
|
||||
#define ARG_FORCE "--force"
|
||||
|
||||
CLI::FP_UPGRADE_COMMAND::FP_UPGRADE_COMMAND() : PCB_EXPORT_BASE_COMMAND( "upgrade", true, true )
|
||||
CLI::FP_UPGRADE_COMMAND::FP_UPGRADE_COMMAND() :
|
||||
PCB_EXPORT_BASE_COMMAND( "upgrade", true, true )
|
||||
{
|
||||
m_argParser.add_description( UTF8STDSTR( _( "Upgrades the footprint library to the current "
|
||||
"kicad version format" ) ) );
|
||||
|
@ -32,7 +32,7 @@
|
||||
#include <wx/crt.h>
|
||||
|
||||
CLI::PCB_EXPORT_BASE_COMMAND::PCB_EXPORT_BASE_COMMAND( const std::string& aName,
|
||||
bool aInputIsDir,
|
||||
bool aInputCanBeDir,
|
||||
bool aOutputIsDir ) :
|
||||
COMMAND( aName )
|
||||
{
|
||||
@ -40,7 +40,7 @@ CLI::PCB_EXPORT_BASE_COMMAND::PCB_EXPORT_BASE_COMMAND( const std::string& aName,
|
||||
m_requireLayers = false;
|
||||
m_hasLayerArg = false;
|
||||
|
||||
addCommonArgs( true, true, aInputIsDir, aOutputIsDir );
|
||||
addCommonArgs( true, true, aInputCanBeDir, aOutputIsDir );
|
||||
|
||||
// Build list of layer names and their layer mask:
|
||||
for( int layer = 0; layer < PCB_LAYER_ID_COUNT; ++layer )
|
||||
|
@ -70,7 +70,7 @@ namespace CLI
|
||||
|
||||
struct PCB_EXPORT_BASE_COMMAND : public COMMAND
|
||||
{
|
||||
PCB_EXPORT_BASE_COMMAND( const std::string& aName, bool aInputIsDir = false,
|
||||
PCB_EXPORT_BASE_COMMAND( const std::string& aName, bool aInputCanBeDir = false,
|
||||
bool aOutputIsDir = false );
|
||||
|
||||
protected:
|
||||
|
@ -43,8 +43,8 @@
|
||||
#define ARG_DRILL_ORIGIN "--drill-origin"
|
||||
|
||||
|
||||
CLI::PCB_EXPORT_DRILL_COMMAND::PCB_EXPORT_DRILL_COMMAND() : PCB_EXPORT_BASE_COMMAND( "drill",
|
||||
false, true )
|
||||
CLI::PCB_EXPORT_DRILL_COMMAND::PCB_EXPORT_DRILL_COMMAND() :
|
||||
PCB_EXPORT_BASE_COMMAND( "drill", false, true )
|
||||
{
|
||||
m_argParser.add_description( UTF8STDSTR( _( "Generate Drill Files" ) ) );
|
||||
|
||||
|
@ -37,7 +37,8 @@
|
||||
#define ARG_MODE_SINGLE "--mode-single"
|
||||
#define ARG_MODE_MULTI "--mode-multi"
|
||||
|
||||
CLI::PCB_EXPORT_DXF_COMMAND::PCB_EXPORT_DXF_COMMAND() : PCB_EXPORT_BASE_COMMAND( "dxf" )
|
||||
CLI::PCB_EXPORT_DXF_COMMAND::PCB_EXPORT_DXF_COMMAND() :
|
||||
PCB_EXPORT_BASE_COMMAND( "dxf", false, true )
|
||||
{
|
||||
m_argParser.add_description( UTF8STDSTR( _( "Generate a DXF from a list of layers" ) ) );
|
||||
|
||||
|
@ -32,7 +32,8 @@
|
||||
#include <locale_io.h>
|
||||
|
||||
|
||||
CLI::PCB_EXPORT_GENCAD_COMMAND::PCB_EXPORT_GENCAD_COMMAND() : PCB_EXPORT_BASE_COMMAND( "gencad" )
|
||||
CLI::PCB_EXPORT_GENCAD_COMMAND::PCB_EXPORT_GENCAD_COMMAND() :
|
||||
PCB_EXPORT_BASE_COMMAND( "gencad", false, true )
|
||||
{
|
||||
// TODO: Update string to remove reference to layers
|
||||
m_argParser.add_description( UTF8STDSTR( _( "Generate Gencad from a list of layers" ) ) );
|
||||
|
@ -32,7 +32,8 @@
|
||||
#define ARG_MODE_MULTIPAGE "--mode-multipage"
|
||||
#define ARG_MODE_SINGLE "--mode-single"
|
||||
|
||||
CLI::PCB_EXPORT_PDF_COMMAND::PCB_EXPORT_PDF_COMMAND() : PCB_EXPORT_BASE_COMMAND( "pdf" )
|
||||
CLI::PCB_EXPORT_PDF_COMMAND::PCB_EXPORT_PDF_COMMAND() :
|
||||
PCB_EXPORT_BASE_COMMAND( "pdf", false, true )
|
||||
{
|
||||
m_argParser.add_description( UTF8STDSTR( _( "Generate PDF from a list of layers" ) ) );
|
||||
|
||||
|
@ -41,7 +41,8 @@
|
||||
#define ARG_GERBER_BOARD_EDGE "--gerber-board-edge"
|
||||
|
||||
|
||||
CLI::PCB_EXPORT_POS_COMMAND::PCB_EXPORT_POS_COMMAND() : PCB_EXPORT_BASE_COMMAND( "pos" )
|
||||
CLI::PCB_EXPORT_POS_COMMAND::PCB_EXPORT_POS_COMMAND() :
|
||||
PCB_EXPORT_BASE_COMMAND( "pos" )
|
||||
{
|
||||
m_argParser.add_description( UTF8STDSTR( _( "Generate Position File" ) ) );
|
||||
|
||||
|
@ -36,7 +36,8 @@
|
||||
#define ARG_MODE_SINGLE "--mode-single"
|
||||
#define ARG_MODE_MULTI "--mode-multi"
|
||||
|
||||
CLI::PCB_EXPORT_SVG_COMMAND::PCB_EXPORT_SVG_COMMAND() : PCB_EXPORT_BASE_COMMAND( "svg" )
|
||||
CLI::PCB_EXPORT_SVG_COMMAND::PCB_EXPORT_SVG_COMMAND() :
|
||||
PCB_EXPORT_BASE_COMMAND( "svg", false, true )
|
||||
{
|
||||
m_argParser.add_description( UTF8STDSTR( _( "Generate SVG outputs of a given layer list" ) ) );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user