kicad-cli: correctly label non-existent fields
Fixes: https://gitlab.com/kicad/code/kicad/-/issues/16085
This commit is contained in:
parent
0422d2e70f
commit
5734a55515
|
@ -456,10 +456,12 @@ int EESCHEMA_JOBS_HANDLER::JobExportBom( JOB* aJob )
|
||||||
field.groupBy = std::find( aBomJob->m_fieldsGroupBy.begin(),
|
field.groupBy = std::find( aBomJob->m_fieldsGroupBy.begin(),
|
||||||
aBomJob->m_fieldsGroupBy.end(), field.name )
|
aBomJob->m_fieldsGroupBy.end(), field.name )
|
||||||
!= aBomJob->m_fieldsGroupBy.end();
|
!= aBomJob->m_fieldsGroupBy.end();
|
||||||
field.label = ( ( aBomJob->m_fieldsLabels.size() > i )
|
if( ( aBomJob->m_fieldsLabels.size() > i ) && !aBomJob->m_fieldsLabels[i].IsEmpty() )
|
||||||
&& !aBomJob->m_fieldsLabels[i].IsEmpty() )
|
field.label = aBomJob->m_fieldsLabels[i];
|
||||||
? aBomJob->m_fieldsLabels[i]
|
else if( IsTextVar( field.name ) )
|
||||||
: field.name;
|
field.label = GetTextVars( field.name );
|
||||||
|
else
|
||||||
|
field.label = field.name;
|
||||||
|
|
||||||
preset.fieldsOrdered.emplace_back( field );
|
preset.fieldsOrdered.emplace_back( field );
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -158,6 +158,13 @@ int CLI::SCH_EXPORT_BOM_COMMAND::doPerform( KIWAY& aKiway )
|
||||||
convertStringList( From_UTF8( m_argParser.get<std::string>( ARG_FIELDS ).c_str() ) );
|
convertStringList( From_UTF8( m_argParser.get<std::string>( ARG_FIELDS ).c_str() ) );
|
||||||
bomJob->m_fieldsLabels =
|
bomJob->m_fieldsLabels =
|
||||||
convertStringList( From_UTF8( m_argParser.get<std::string>( ARG_LABELS ).c_str() ) );
|
convertStringList( From_UTF8( m_argParser.get<std::string>( ARG_LABELS ).c_str() ) );
|
||||||
|
|
||||||
|
// We only apply the default labels if the default fields are used
|
||||||
|
if( m_argParser.is_used( ARG_FIELDS ) && !m_argParser.is_used( ARG_LABELS ) )
|
||||||
|
{
|
||||||
|
bomJob->m_fieldsLabels.clear();
|
||||||
|
}
|
||||||
|
|
||||||
bomJob->m_fieldsGroupBy =
|
bomJob->m_fieldsGroupBy =
|
||||||
convertStringList( From_UTF8( m_argParser.get<std::string>( ARG_GROUP_BY ).c_str() ) );
|
convertStringList( From_UTF8( m_argParser.get<std::string>( ARG_GROUP_BY ).c_str() ) );
|
||||||
bomJob->m_sortField = From_UTF8( m_argParser.get<std::string>( ARG_SORT_FIELD ).c_str() );
|
bomJob->m_sortField = From_UTF8( m_argParser.get<std::string>( ARG_SORT_FIELD ).c_str() );
|
||||||
|
|
Loading…
Reference in New Issue