kicad-cli: sch bom export: fix inability to disable grouping

Just set --group-by default to "" (No default grouping), and drop the
additional --group option. Also fix the exclude DNP option.

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/15246
This commit is contained in:
Mike Williams 2023-07-23 13:59:28 -04:00
parent ce58208d77
commit 7d9f791518
4 changed files with 7 additions and 15 deletions

View File

@ -45,7 +45,7 @@ public:
m_sortField(),
m_sortAsc( true ),
m_filterString(),
m_groupSymbols( true )
m_excludeDNP( false )
{
}
@ -68,7 +68,7 @@ public:
wxString m_sortField;
bool m_sortAsc;
wxString m_filterString;
bool m_groupSymbols;
bool m_excludeDNP;
};
#endif

View File

@ -336,8 +336,9 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
preset.sortAsc = aBomJob->m_sortAsc;
preset.sortField = aBomJob->m_sortField;
preset.groupSymbols = aBomJob->m_groupSymbols;
preset.filterString = aBomJob->m_filterString;
preset.groupSymbols = ( aBomJob->m_fieldsGroupBy.size() > 0 );
preset.excludeDNP = aBomJob->m_excludeDNP;
dataModel.ApplyBomPreset( preset );

View File

@ -42,7 +42,7 @@ CLI::EXPORT_SCH_BOM_COMMAND::EXPORT_SCH_BOM_COMMAND() : EXPORT_PCB_BASE_COMMAND(
m_argParser.add_argument( ARG_GROUP_BY )
.help( UTF8STDSTR( _( ARG_GROUP_BY_DESC ) ) )
.default_value( std::string( "Value,Footprint,${DNP}" ) );
.default_value( std::string( "" ) );
m_argParser.add_argument( ARG_SORT_FIELD )
.help( UTF8STDSTR( _( ARG_SORT_FIELD_DESC ) ) )
@ -57,15 +57,10 @@ CLI::EXPORT_SCH_BOM_COMMAND::EXPORT_SCH_BOM_COMMAND() : EXPORT_PCB_BASE_COMMAND(
.help( UTF8STDSTR( _( ARG_FILTER_DESC ) ) )
.default_value( std::string( "" ) );
m_argParser.add_argument( ARG_GROUP_SYMBOLS )
.help( UTF8STDSTR( _( ARG_GROUP_SYMBOLS_DESC ) ) )
.implicit_value( true )
.default_value( true );
m_argParser.add_argument( ARG_EXCLUDE_DNP )
.help( UTF8STDSTR( _( ARG_EXCLUDE_DNP_DESC ) ) )
.implicit_value( true )
.default_value( true );
.default_value( false );
// Output formatting options
m_argParser.add_argument( ARG_FIELD_DELIMITER )
@ -140,8 +135,7 @@ int CLI::EXPORT_SCH_BOM_COMMAND::doPerform( KIWAY& aKiway )
bomJob->m_sortField = FROM_UTF8( m_argParser.get<std::string>( ARG_SORT_FIELD ).c_str() );
bomJob->m_sortAsc = m_argParser.get<bool>( ARG_SORT_ASC );
bomJob->m_filterString = FROM_UTF8( m_argParser.get<std::string>( ARG_FILTER ).c_str() );
bomJob->m_groupSymbols = m_argParser.get<bool>( ARG_GROUP_SYMBOLS );
bomJob->m_groupSymbols = m_argParser.get<bool>( ARG_EXCLUDE_DNP );
bomJob->m_excludeDNP = m_argParser.get<bool>( ARG_EXCLUDE_DNP );
if( !wxFile::Exists( bomJob->m_filename ) )
{

View File

@ -64,9 +64,6 @@ namespace CLI
#define ARG_FILTER "--filter"
#define ARG_FILTER_DESC "Filter string to remove output lines."
#define ARG_GROUP_SYMBOLS "--group"
#define ARG_GROUP_SYMBOLS_DESC "Enable grouping of references with matching group-by fields."
#define ARG_EXCLUDE_DNP "--exclude-dnp"
#define ARG_EXCLUDE_DNP_DESC "Exclude symbols marked Do-Not-Populate."