From bc65f3b5152fd3417b78cba8312bf72b21e92f3f Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Tue, 24 Jan 2023 23:36:38 -0500 Subject: [PATCH] Lazily fix the output arg string for sch svg export Big brain, just use the string with the colon in it. Sue me. Fixes https://gitlab.com/kicad/code/kicad/-/issues/13647 --- kicad/cli/command_export_pcb_base.cpp | 19 +++++++++++++++---- kicad/cli/command_export_pcb_base.h | 2 +- kicad/cli/command_export_sch_svg.cpp | 2 +- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/kicad/cli/command_export_pcb_base.cpp b/kicad/cli/command_export_pcb_base.cpp index 5a539e6ed5..733ae20667 100644 --- a/kicad/cli/command_export_pcb_base.cpp +++ b/kicad/cli/command_export_pcb_base.cpp @@ -28,15 +28,26 @@ #include #include -CLI::EXPORT_PCB_BASE_COMMAND::EXPORT_PCB_BASE_COMMAND( const std::string& aName ) : COMMAND( aName ) +CLI::EXPORT_PCB_BASE_COMMAND::EXPORT_PCB_BASE_COMMAND( const std::string& aName, + bool aOutputIsDir ) : + COMMAND( aName ) { m_selectedLayersSet = false; m_requireLayers = false; m_hasLayerArg = false; - m_argParser.add_argument( "-o", ARG_OUTPUT ) - .default_value( std::string() ) - .help( UTF8STDSTR( _( "Output file name" ) ) ); + 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" ) ) ); diff --git a/kicad/cli/command_export_pcb_base.h b/kicad/cli/command_export_pcb_base.h index c40abf9c67..e97f803675 100644 --- a/kicad/cli/command_export_pcb_base.h +++ b/kicad/cli/command_export_pcb_base.h @@ -40,7 +40,7 @@ namespace CLI struct EXPORT_PCB_BASE_COMMAND : public COMMAND { - EXPORT_PCB_BASE_COMMAND( const std::string& aName ); + EXPORT_PCB_BASE_COMMAND( const std::string& aName, bool aOutputIsDir = false ); protected: int doPerform( KIWAY& aKiway ) override; diff --git a/kicad/cli/command_export_sch_svg.cpp b/kicad/cli/command_export_sch_svg.cpp index 8dbf5f1eac..6e6bc5bac7 100644 --- a/kicad/cli/command_export_sch_svg.cpp +++ b/kicad/cli/command_export_sch_svg.cpp @@ -31,7 +31,7 @@ #define ARG_EXCLUDE_DRAWING_SHEET "--exclude-drawing-sheet" #define ARG_NO_BACKGROUND_COLOR "--no-background-color" -CLI::EXPORT_SCH_SVG_COMMAND::EXPORT_SCH_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( "svg" ) +CLI::EXPORT_SCH_SVG_COMMAND::EXPORT_SCH_SVG_COMMAND() : EXPORT_PCB_BASE_COMMAND( "svg", true ) { m_argParser.add_argument( "-t", ARG_THEME ) .default_value( std::string() )