Change up the step export arg handling to single quote for now

Fixes https://gitlab.com/kicad/code/kicad/-/issues/12890
This commit is contained in:
Marek Roszko 2022-11-13 11:49:20 -05:00
parent 0a8db3bb88
commit ea83449ef7
2 changed files with 10 additions and 15 deletions

View File

@ -140,21 +140,17 @@ int CLI::EXPORT_PCB_STEP_COMMAND::Perform( KIWAY& aKiway )
wxString minDistance = FROM_UTF8( m_argParser.get<std::string>( ARG_MIN_DISTANCE ).c_str() ); wxString minDistance = FROM_UTF8( m_argParser.get<std::string>( ARG_MIN_DISTANCE ).c_str() );
if( !minDistance.IsEmpty() ) if( !minDistance.IsEmpty() )
{ {
std::istringstream istr; std::regex re_pattern( REGEX_QUANTITY REGEX_UNIT,
istr.str( std::string( minDistance.ToUTF8() ) ); std::regex_constants::icase );
istr >> step->m_minDistance; std::smatch sm;
std::string str( minDistance.ToUTF8() );
std::regex_search( str, sm, re_pattern );
step->m_minDistance = atof( sm.str( 1 ).c_str() );
if( istr.fail() ) std::string tunit( sm[2] );
if( tunit.size() > 0 ) // No unit accepted ( default = mm )
{ {
std::cout << m_argParser;
return CLI::EXIT_CODES::ERR_ARGS;
}
if( !istr.eof() )
{
std::string tunit;
istr >> tunit;
if( !tunit.compare( "in" ) || !tunit.compare( "inch" ) ) if( !tunit.compare( "in" ) || !tunit.compare( "inch" ) )
{ {
step->m_minDistance *= 25.4; step->m_minDistance *= 25.4;

View File

@ -377,7 +377,6 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
} }
#endif #endif
appK2S.SetName( wxT( "kicad-cli" ) ); appK2S.SetName( wxT( "kicad-cli" ) );
wxString cmdK2S = wxT( "\"" ); wxString cmdK2S = wxT( "\"" );
@ -396,7 +395,7 @@ void DIALOG_EXPORT_STEP::onExportButton( wxCommandEvent& aEvent )
// Note: for some reason, using \" to insert a quote in a format string, under MacOS // Note: for some reason, using \" to insert a quote in a format string, under MacOS
// wxString::Format does not work. So use a %c format in string // wxString::Format does not work. So use a %c format in string
int quote = '"'; int quote = '\'';
switch( GetOriginOption() ) switch( GetOriginOption() )
{ {