KiCad PCB EDA Suite
Loading...
Searching...
No Matches
kicad_cli.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
21
22#include <wx/filename.h>
23#include <wx/log.h>
24#include <wx/stdpaths.h>
25#include <wx/wxcrtvararg.h> //for wxPrintf
26
27#include <kiway.h>
29#include <string_utils.h>
30#include <paths.h>
33#include <systemdirsappend.h>
34#include <trace_helpers.h>
35
36#include <cctype>
37#include <set>
38#include <cstdlib>
39
40#include "pgm_kicad.h"
41#include "kicad_manager_frame.h"
42
43#include <build_version.h>
44#include <kiplatform/app.h>
46#include <locale_io.h>
47
48#include <git/git_backend.h>
49#include <git/libgit_backend.h>
50
51#include "cli/command_jobset.h"
53#include "cli/command_pcb.h"
55#include "cli/command_fp_diff.h"
57#include "cli/command_pcb_drc.h"
85#include "cli/command_import.h"
86#include "cli/command_fp.h"
90#include "cli/command_sch.h"
91#include "cli/command_sch_erc.h"
94#include "cli/command_sym.h"
98#include "cli/command_gerber.h"
104#include "cli/command_version.h"
105#include "cli/exit_codes.h"
106
107// Add this header after all others, to avoid a collision name in a Windows header
108// on mingw.
109#include <wx/app.h>
110
111// a dummy to quiet linking with EDA_BASE_FRAME::config();
112#include <kiface_base.h>
113#include <thread_pool.h>
114
115
117{
118 // This function should never be called. It is only referenced from
119 // EDA_BASE_FRAME::config() and this is only provided to satisfy the linker,
120 // not to be actually called.
121 wxFprintf( stderr,
122 wxT( "Unexpected call to Kiface() in kicad/kicad_cli.cpp — a "
123 "code path is reaching into a kiface stub from the CLI "
124 "process. Re-run with KICAD_TRACE=KICAD for a backtrace.\n" ) );
125 std::abort();
126}
127
128
130{
132
133 std::vector<COMMAND_ENTRY> subCommands;
134
136 handler( aHandler ) {};
137 COMMAND_ENTRY( CLI::COMMAND* aHandler, std::vector<COMMAND_ENTRY> aSub ) :
138 handler( aHandler ),
139 subCommands( aSub ) {};
140};
141
156static CLI::PCB_EXPORT_3D_COMMAND exportPcbGlbCmd{ "glb", UTF8STDSTR( _( "Export GLB (binary GLTF)" ) ),
226
227// clang-format off
228static std::vector<COMMAND_ENTRY> commandStack = {
229 {
230 &jobsetCmd,
231 {
232 {
234 }
235 }
236 },
237 {
238 &fpCmd,
239 {
240 {
241 &fpDiffCmd
242 },
243 {
245 {
247 }
248 },
249 {
251 }
252 }
253 },
254 {
255 &pcbCmd,
256 {
257 {
259 },
260 {
261 &pcbDrcCmd
262 },
263 {
265 },
266 {
268 },
269 {
271 {
296 }
297 },
298 {
300 }
301 }
302 },
303 {
304 &schCmd,
305 {
306 {
308 },
309 {
310 &schErcCmd
311 },
312 {
314 },
315 {
317 {
327 }
328 },
329 {
331 }
332 }
333 },
334 {
335 &symCmd,
336 {
337 {
339 },
340 {
342 {
344 }
345 },
346 {
348 }
349 }
350 },
351 {
352 &gerberCmd,
353 {
354 {
356 {
357 {
359 }
360 }
361 },
362 {
364 },
365 {
367 }
368 }
369 },
370 {
372 },
373 {
374 // Hidden from --help (set_suppress); invoked by git via the
375 // merge.kicad-*.driver config, not by users.
377 },
378 {
379 &importCmd,
380 },
381 {
382 &versionCmd,
383 },
384 {
386 }
387};
388// clang-format on
389
390
391static void recurseArgParserBuild( argparse::ArgumentParser& aArgParser, COMMAND_ENTRY& aEntry )
392{
393 aArgParser.add_subparser( aEntry.handler->GetArgParser() );
394
395 for( COMMAND_ENTRY& subEntry : aEntry.subCommands )
396 {
397 recurseArgParserBuild( aEntry.handler->GetArgParser(), subEntry );
398 }
399}
400
401
402static COMMAND_ENTRY* recurseArgParserSubCommandUsed( argparse::ArgumentParser& aArgParser, COMMAND_ENTRY& aEntry )
403{
404 COMMAND_ENTRY* cliCmd = nullptr;
405
406 if( aArgParser.is_subcommand_used( aEntry.handler->GetName() ) )
407 {
408 for( COMMAND_ENTRY& subentry : aEntry.subCommands )
409 {
410 cliCmd = recurseArgParserSubCommandUsed( aEntry.handler->GetArgParser(), subentry );
411 if( cliCmd )
412 break;
413 }
414
415 if( !cliCmd )
416 cliCmd = &aEntry;
417 }
418
419 return cliCmd;
420}
421
422
423static void printHelp( argparse::ArgumentParser& argParser )
424{
425 std::stringstream ss;
426 ss << argParser;
427 wxPrintf( From_UTF8( ss.str().c_str() ) );
428}
429
430
437static bool looksLikeNegativeVectorValue( const std::string& aValue )
438{
439 if( aValue.empty() || aValue[0] != '-' )
440 return false;
441
442 if( aValue.find( ',' ) == std::string::npos )
443 return false;
444
445 for( size_t i = 1; i < aValue.size(); ++i )
446 {
447 char c = aValue[i];
448
449 if( !std::isdigit( c ) && c != '.' && c != ',' && c != '-' && c != '+' )
450 return false;
451 }
452
453 return true;
454}
455
456
468static std::vector<std::string> preprocessArgs( int argc, char** argv )
469{
470 std::vector<std::string> result;
471
472 static const std::set<std::string> vectorArgs = { "--rotate", "--pan", "--pivot" };
473
474 for( int i = 0; i < argc; ++i )
475 {
476 std::string current( argv[i] );
477
478 if( vectorArgs.count( current ) && i + 1 < argc )
479 {
480 std::string next( argv[i + 1] );
481
483 {
484 result.push_back( current + "='" + next + "'" );
485 ++i;
486 continue;
487 }
488 }
489
490 result.push_back( current );
491 }
492
493 return result;
494}
495
496
498{
500 App().SetAppDisplayName( wxT( "kicad-cli" ) );
501
502#if defined( DEBUG )
503 wxString absoluteArgv0 = wxStandardPaths::Get().GetExecutablePath();
504
505 if( !wxIsAbsolutePath( absoluteArgv0 ) )
506 {
507 wxLogError( wxT( "No meaningful argv[0]" ) );
508 return false;
509 }
510#endif
511
512 // Initialize the git backend so VCS text-eval functions work in CLI mode
513 SetGitBackend( new LIBGIT_BACKEND() );
514 GetGitBackend()->Init();
515
516 if( !InitPgm( true ) )
517 return false;
518
519 m_bm.InitSettings( new KICAD_SETTINGS );
522 m_bm.Init();
523
525
526 return true;
527}
528
529
531{
532 argparse::ArgumentParser argParser( std::string( "kicad-cli" ), GetMajorMinorVersion().ToStdString(),
533 argparse::default_arguments::none );
534
535 argParser.add_argument( "-v", ARG_VERSION )
536 .help( UTF8STDSTR( _( "prints version information and exits" ) ) )
537 .flag()
538 .nargs( 0 );
539
540 argParser.add_argument( ARG_HELP_SHORT, ARG_HELP ).help( UTF8STDSTR( ARG_HELP_DESC ) ).flag().nargs( 0 );
541
542 for( COMMAND_ENTRY& entry : commandStack )
543 {
544 recurseArgParserBuild( argParser, entry );
545 }
546
547 try
548 {
549 // Use the C locale to parse arguments
550 // Otherwise the decimal separator for the locale will be applied
551 LOCALE_IO dummy;
552
553 // Pre-process arguments to handle negative vector values (e.g., --rotate -45,0,45)
554 // which argparse would otherwise interpret as unknown options
555 std::vector<std::string> args = preprocessArgs( m_argcUtf8, m_argvUtf8 );
556 argParser.parse_args( args );
557 }
558 // std::runtime_error doesn't seem to be enough for the scan<>()
559 catch( const std::exception& err )
560 {
561 bool requestedHelp = false;
562
563 for( int i = 0; i < m_argcUtf8; ++i )
564 {
565 if( std::string arg( m_argvUtf8[i] ); arg == ARG_HELP_SHORT || arg == ARG_HELP )
566 {
567 requestedHelp = true;
568 break;
569 }
570 }
571
572 if( !requestedHelp )
573 wxPrintf( "%s\n", err.what() );
574
575 // find the correct argparser object to output the command usage info
576 COMMAND_ENTRY* cliCmd = nullptr;
577 for( COMMAND_ENTRY& entry : commandStack )
578 {
579 if( argParser.is_subcommand_used( entry.handler->GetName() ) )
580 {
581 cliCmd = recurseArgParserSubCommandUsed( argParser, entry );
582 }
583 }
584
585 // arg parser uses a stream overload for printing the help
586 // we want to intercept so we can wxString the utf8 contents
587 // because on windows our terminal codepage might not be utf8
588 if( cliCmd )
589 cliCmd->handler->PrintHelp();
590 else
591 {
592 printHelp( argParser );
593 }
594
595 return requestedHelp ? 0 : CLI::EXIT_CODES::ERR_ARGS;
596 }
597
598 if( argParser[ARG_HELP] == true )
599 {
600 std::stringstream ss;
601 ss << argParser;
602 wxPrintf( From_UTF8( ss.str().c_str() ) );
603
604 return 0;
605 }
606
607 CLI::COMMAND* cliCmd = nullptr;
608
609 // the version arg gets redirected to the version subcommand
610 if( argParser[ARG_VERSION] == true )
611 {
612 cliCmd = &versionCmd;
613 }
614
615 if( !cliCmd )
616 {
617 for( COMMAND_ENTRY& entry : commandStack )
618 {
619 if( argParser.is_subcommand_used( entry.handler->GetName() ) )
620 {
621 COMMAND_ENTRY* cmdSubEntry = recurseArgParserSubCommandUsed( argParser, entry );
622 if( cmdSubEntry != nullptr )
623 {
624 cliCmd = cmdSubEntry->handler;
625 break;
626 }
627 }
628 }
629 }
630
631 if( cliCmd )
632 {
633 int exitCode = cliCmd->Perform( Kiway );
634
635 if( exitCode != CLI::EXIT_CODES::AVOID_CLOSING )
636 {
637 return exitCode;
638 }
639 else
640 {
641 return 0;
642 }
643 }
644 else
645 {
646 printHelp( argParser );
647
649 }
650}
651
652
654{
655 // Abort and wait on any background jobs
656 GetKiCadThreadPool().purge();
657 GetKiCadThreadPool().wait();
658
660
662 {
664 m_settings_manager->Save();
665 }
666
667 if( GetGitBackend() )
668 {
670 delete GetGitBackend();
671 SetGitBackend( nullptr );
672 }
673
674 // Destroy everything in PGM_KICAD,
675 // especially wxSingleInstanceCheckerImpl earlier than wxApp and earlier
676 // than static destruction would.
677 Destroy();
678}
679
680
681void PGM_KICAD::MacOpenFile( const wxString& aFileName )
682{
683#if defined( __WXMAC__ )
684 wxFAIL_MSG( "kicad-cli should not call MacOpenFile" );
685#endif
686}
687
688
690{
691 // unlike a normal destructor, this is designed to be called more
692 // than once safely:
693
694 m_bm.End();
695
697}
698
699
701
703
707struct APP_KICAD_CLI : public wxAppConsole
708{
710 wxAppConsole()
711 {
712 SetPgm( &program );
713
714 // Init the environment each platform wants
716 }
717
718
719 bool OnInit() override
720 {
721 // Perform platform-specific init tasks
722 if( !KIPLATFORM::APP::Init() )
723 return false;
724
725#ifndef DEBUG
726 // Enable logging traces to the console in release build.
727 // This is usually disabled, but it can be useful for users to run to help
728 // debug issues and other problems.
729 if( wxGetEnv( wxS( "KICAD_ENABLE_WXTRACE" ), nullptr ) )
730 {
731 wxLog::EnableLogging( true );
732 wxLog::SetLogLevel( wxLOG_Trace );
733 }
734#endif
735
736 if( !program.OnPgmInit() )
737 {
738 program.OnPgmExit();
739 return false;
740 }
741
742 return true;
743 }
744
745 int OnExit() override
746 {
747 // Drain any pending wx-managed objects before tearing down PGM_BASE
748 // singletons so destructors can still call into Pgm(). See
749 // https://gitlab.com/kicad/code/kicad/-/issues/23373 for the GUI variant
750 // of this hazard; kept consistent with the GUI apps for parity.
751 int ret = wxAppConsole::OnExit();
752
753#if defined( __FreeBSD__ )
754 // Avoid wxLog crashing when used in destructors invoked from OnPgmExit().
755 wxLog::EnableLogging( false );
756#endif
757
758 program.OnPgmExit();
759 return ret;
760 }
761
762 int OnRun() override
763 {
764 try
765 {
766 return program.OnPgmRun();
767 }
768 catch( ... )
769 {
770 Pgm().HandleException( std::current_exception() );
771 }
772
773 return -1;
774 }
775
776 int FilterEvent( wxEvent& aEvent ) override { return Event_Skip; }
777
778#if defined( DEBUG )
782 bool ProcessEvent( wxEvent& aEvent ) override
783 {
784 if( aEvent.GetEventType() == wxEVT_CHAR || aEvent.GetEventType() == wxEVT_CHAR_HOOK )
785 {
786 wxKeyEvent* keyEvent = static_cast<wxKeyEvent*>( &aEvent );
787
788 if( keyEvent )
789 {
790 wxLogTrace( kicadTraceKeyEvent, "APP_KICAD::ProcessEvent %s", dump( *keyEvent ) );
791 }
792 }
793
794 aEvent.Skip();
795 return false;
796 }
797
805 bool OnExceptionInMainLoop() override
806 {
807 try
808 {
809 throw;
810 }
811 catch( ... )
812 {
813 Pgm().HandleException( std::current_exception() );
814 }
815
816 return false; // continue on. Return false to abort program
817 }
818#endif
819};
820
821IMPLEMENT_APP_CONSOLE( APP_KICAD_CLI )
822
823
824// The C++ project manager supports one open PROJECT, so Prj() calls within
825// this link image need this function.
827{
828 return Kiway.Prj();
829}
wxString GetMajorMinorVersion()
Get only the major and minor version in a string major.minor.
argparse::ArgumentParser & GetArgParser()
Definition command.h:60
const std::string & GetName() const
Definition command.h:61
void PrintHelp()
Definition command.cpp:47
int Perform(KIWAY &aKiway)
Entry point to processing commands from args and doing work.
Definition command.cpp:55
Batch (non-interactive) git merge-driver hook for KiCad documents/libraries.
Top-level kicad-cli import command.
kicad-cli mergetool ANCESTOR OURS THEIRS -o OUTPUT — uniform entry point for git mergetool.
virtual void Shutdown()=0
virtual void Init()=0
A KIFACE implementation.
Definition kiface_base.h:35
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:311
void OnKiwayEnd()
Definition kiway.cpp:811
void LoadGlobalTables(std::initializer_list< LIBRARY_TABLE_TYPE > aTablesToLoad={})
(Re)loads the global library tables in the given list, or all tables if no list is given
virtual wxApp & App()
Return a bare naked wxApp which may come from wxPython, SINGLE_TOP, or kicad.exe.
Definition pgm_base.cpp:204
int m_argcUtf8
Definition pgm_base.h:439
std::unique_ptr< SETTINGS_MANAGER > m_settings_manager
Definition pgm_base.h:403
void Destroy()
Definition pgm_base.cpp:183
char ** m_argvUtf8
argv parameters converted to utf8 form because wxWidgets has opinions.
Definition pgm_base.h:437
void HandleException(std::exception_ptr aPtr, bool aUnhandled=false)
A exception handler to be used at the top level if exceptions bubble up that for.
Definition pgm_base.cpp:789
void BuildArgvUtf8()
Builds the UTF8 based argv variable.
Definition pgm_base.cpp:275
bool InitPgm(bool aHeadless=false, bool aIsUnitTest=false)
Initialize this program.
Definition pgm_base.cpp:320
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:124
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:126
void SaveCommonSettings()
Save the program (process) settings subset which are stored .kicad_common.
Definition pgm_base.cpp:519
PGM_KICAD extends PGM_BASE to bring in FileHistory() and PdfBrowser() which were moved from EDA_APP i...
Definition pgm_kicad.h:35
bool OnPgmInit()
Definition kicad.cpp:99
void Destroy()
Definition kicad.cpp:529
void MacOpenFile(const wxString &aFileName) override
Specific to MacOSX (not used under Linux or Windows).
Definition kicad.cpp:516
void OnPgmExit()
Definition kicad.cpp:485
APP_SETTINGS_BASE * PgmSettings()
Definition pgm_kicad.h:52
int OnPgmRun()
Definition kicad.cpp:479
BIN_MOD m_bm
Definition pgm_kicad.h:65
Container for project specific data.
Definition project.h:62
T * RegisterSettings(T *aSettings, bool aLoadNow=true)
Take ownership of the pointer passed in.
void SetKiway(KIWAY *aKiway)
Associate this setting manager with the given Kiway.
#define ARG_HELP
Definition command.h:30
#define UTF8STDSTR(s)
Definition command.h:27
#define ARG_HELP_DESC
Definition command.h:32
#define ARG_VERSION
Definition command.h:29
#define ARG_HELP_SHORT
Definition command.h:31
#define _(s)
void SetGitBackend(GIT_BACKEND *aBackend)
GIT_BACKEND * GetGitBackend()
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.
PROJECT & Prj()
Definition kicad.cpp:730
static CLI::PCB_EXPORT_SVG_COMMAND exportPcbSvgCmd
static CLI::SCH_EXPORT_PLOT_COMMAND exportSchHpglCmd
static CLI::SCH_EXPORT_PLOT_COMMAND exportSchSvgCmd
static CLI::PCB_EXPORT_3D_COMMAND exportPcbVrmlCmd
static CLI::GERBER_INFO_COMMAND gerberInfoCmd
static CLI::MERGETOOL_COMMAND mergetoolCmd
static CLI::PCB_EXPORT_STATS_COMMAND exportPcbStatsCmd
static CLI::GIT_MERGEDRIVER_COMMAND gitMergeDriverCmd
static CLI::PCB_EXPORT_DXF_COMMAND exportPcbDxfCmd
static CLI::SCH_ERC_COMMAND schErcCmd
static CLI::PCB_EXPORT_HPGL_COMMAND exportPcbHpglCmd
static CLI::PCB_DRC_COMMAND pcbDrcCmd
static std::vector< std::string > preprocessArgs(int argc, char **argv)
Pre-process command line arguments to handle negative numeric values.
static CLI::PCB_IMPORT_COMMAND pcbImportCmd
static CLI::FP_EXPORT_SVG_COMMAND fpExportSvgCmd
static CLI::PCB_EXPORT_COMMAND exportPcbCmd
static CLI::PCB_RENDER_COMMAND pcbRenderCmd
static bool looksLikeNegativeVectorValue(const std::string &aValue)
Check if a string looks like a numeric vector value that happens to start with a minus sign.
static CLI::SCH_DIFF_COMMAND schDiffCmd
static CLI::SYM_UPGRADE_COMMAND symUpgradeCmd
static CLI::FP_EXPORT_COMMAND fpExportCmd
static CLI::SCH_EXPORT_PYTHONBOM_COMMAND exportSchPythonBomCmd
static CLI::FP_UPGRADE_COMMAND fpUpgradeCmd
static CLI::SCH_EXPORT_PLOT_COMMAND exportSchPdfCmd
static void printHelp(argparse::ArgumentParser &argParser)
static CLI::JOBSET_RUN_COMMAND jobsetRunCmd
static CLI::PCB_DIFF_COMMAND pcbDiffCmd
static CLI::PCB_UPGRADE_COMMAND pcbUpgradeCmd
static CLI::PCB_EXPORT_POS_COMMAND exportPcbPosCmd
static CLI::GERBER_DIFF_COMMAND gerberDiffCmd
static CLI::PCB_EXPORT_PS_COMMAND exportPcbPsCmd
static CLI::GERBER_COMMAND gerberCmd
static CLI::IMPORT_COMMAND importCmd
static CLI::FP_DIFF_COMMAND fpDiffCmd
static CLI::SYM_COMMAND symCmd
static CLI::SCH_IMPORT_COMMAND schImportCmd
static CLI::PCB_EXPORT_3D_COMMAND exportPcbStepCmd
static CLI::PCB_EXPORT_3D_COMMAND exportPcbPlyCmd
static CLI::PCB_EXPORT_GERBERS_COMMAND exportPcbGerbersCmd
static PGM_KICAD program
static CLI::SCH_EXPORT_BOM_COMMAND exportSchBomCmd
static CLI::GERBER_CONVERT_PNG_COMMAND gerberConvertPngCmd
static CLI::PCB_EXPORT_IPCD356_COMMAND exportPcbIpcD356Cmd
static CLI::SCH_COMMAND schCmd
static CLI::PCB_COMMAND pcbCmd
static CLI::PCB_EXPORT_3D_COMMAND exportPcb3DPDFCmd
static std::vector< COMMAND_ENTRY > commandStack
static CLI::PCB_EXPORT_DRILL_COMMAND exportPcbDrillCmd
static CLI::SCH_EXPORT_PLOT_COMMAND exportSchPngCmd
static CLI::PCB_EXPORT_IPC2581_COMMAND exportPcbIpc2581Cmd
static CLI::SCH_EXPORT_PLOT_COMMAND exportSchDxfCmd
static CLI::JOBSET_COMMAND jobsetCmd
static CLI::SYM_EXPORT_COMMAND symExportCmd
static CLI::SYM_EXPORT_SVG_COMMAND symExportSvgCmd
static COMMAND_ENTRY * recurseArgParserSubCommandUsed(argparse::ArgumentParser &aArgParser, COMMAND_ENTRY &aEntry)
static CLI::PCB_EXPORT_3D_COMMAND exportPcbU3DCmd
KIFACE_BASE & Kiface()
Global KIFACE_BASE "get" accessor.
static CLI::SYM_DIFF_COMMAND symDiffCmd
static CLI::PCB_EXPORT_ODB_COMMAND exportPcbOdbCmd
static CLI::VERSION_COMMAND versionCmd
static CLI::PCB_EXPORT_3D_COMMAND exportPcbStlCmd
static CLI::PCB_EXPORT_PDF_COMMAND exportPcbPdfCmd
static CLI::SCH_UPGRADE_COMMAND schUpgradeCmd
static CLI::PCB_EXPORT_3D_COMMAND exportPcbXaoCmd
static void recurseArgParserBuild(argparse::ArgumentParser &aArgParser, COMMAND_ENTRY &aEntry)
static CLI::API_SERVER_COMMAND apiServerCmd
static CLI::SCH_EXPORT_NETLIST_COMMAND exportSchNetlistCmd
static CLI::PCB_EXPORT_PNG_COMMAND exportPcbPngCmd
static CLI::SCH_EXPORT_PLOT_COMMAND exportSchPostscriptCmd
static CLI::PCB_EXPORT_GENCAD_COMMAND exportPcbGencadCmd
static CLI::GERBER_CONVERT_COMMAND gerberConvertCmd
static CLI::PCB_EXPORT_3D_COMMAND exportPcbStepzCmd
static CLI::FP_COMMAND fpCmd
static CLI::PCB_EXPORT_3D_COMMAND exportPcbGlbCmd
static CLI::SCH_EXPORT_COMMAND exportSchCmd
static CLI::PCB_EXPORT_3D_COMMAND exportPcbBrepCmd
#define KFCTL_CPP_PROJECT_SUITE
Running under C++ project mgr, possibly with others.
Definition kiway.h:160
#define KFCTL_CLI
Running as CLI app.
Definition kiway.h:161
static const int ERR_ARGS
Definition exit_codes.h:31
static const int AVOID_CLOSING
Definition exit_codes.h:28
bool Init()
Perform application-specific initialization tasks.
Definition unix/app.cpp:40
void Init()
Perform environment initialization tasks.
void SetPgm(PGM_BASE *pgm)
PGM_BASE & Pgm()
The global program "get" accessor.
CITER next(CITER it)
Definition ptree.cpp:120
PGM_SINGLE_TOP program
KIWAY Kiway(KFCTL_STANDALONE)
std::vector< FAB_LAYER_COLOR > dummy
wxString From_UTF8(const char *cstring)
Not publicly visible because most of the action is in PGM_KICAD these days.
int OnExit() override
bool OnInit() override
int FilterEvent(wxEvent &aEvent) override
int OnRun() override
COMMAND_ENTRY(CLI::COMMAND *aHandler)
COMMAND_ENTRY(CLI::COMMAND *aHandler, std::vector< COMMAND_ENTRY > aSub)
CLI::COMMAND * handler
std::vector< COMMAND_ENTRY > subCommands
System directories search utilities.
wxString result
Test unit parsing edge cases and error handling.
thread_pool & GetKiCadThreadPool()
Get a reference to the current thread pool.
wxString dump(const wxArrayString &aArray)
Debug helper for printing wxArrayString contents.
wxLogTrace helper definitions.