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"
56#include "cli/command_fp_diff.h"
58#include "cli/command_pcb_drc.h"
87#include "cli/command_import.h"
88#include "cli/command_fp.h"
92#include "cli/command_sch.h"
93#include "cli/command_sch_erc.h"
96#include "cli/command_sym.h"
100#include "cli/command_gerber.h"
106#include "cli/command_version.h"
107#include "cli/exit_codes.h"
108
109// Add this header after all others, to avoid a collision name in a Windows header
110// on mingw.
111#include <wx/app.h>
112
113// a dummy to quiet linking with EDA_BASE_FRAME::config();
114#include <kiface_base.h>
115#include <thread_pool.h>
116
117
119{
120 // This function should never be called. It is only referenced from
121 // EDA_BASE_FRAME::config() and this is only provided to satisfy the linker,
122 // not to be actually called.
123 wxFprintf( stderr,
124 wxT( "Unexpected call to Kiface() in kicad/kicad_cli.cpp — a "
125 "code path is reaching into a kiface stub from the CLI "
126 "process. Re-run with KICAD_TRACE=KICAD for a backtrace.\n" ) );
127 std::abort();
128}
129
130
132{
134
135 std::vector<COMMAND_ENTRY> subCommands;
136
138 handler( aHandler ) {};
139 COMMAND_ENTRY( CLI::COMMAND* aHandler, std::vector<COMMAND_ENTRY> aSub ) :
140 handler( aHandler ),
141 subCommands( aSub ) {};
142};
143
159static CLI::PCB_EXPORT_3D_COMMAND exportPcbGlbCmd{ "glb", UTF8STDSTR( _( "Export GLB (binary GLTF)" ) ),
231
232// clang-format off
233static std::vector<COMMAND_ENTRY> commandStack = {
234 {
235 &jobsetCmd,
236 {
237 {
239 }
240 }
241 },
242 {
243 &fpCmd,
244 {
245 {
246 &fpDiffCmd
247 },
248 {
250 {
252 }
253 },
254 {
256 }
257 }
258 },
259 {
260 &pcbCmd,
261 {
262 {
264 },
265 {
266 &pcbDrcCmd
267 },
268 {
270 },
271 {
273 },
274 {
276 {
304 }
305 },
306 {
308 }
309 }
310 },
311 {
312 &schCmd,
313 {
314 {
316 },
317 {
318 &schErcCmd
319 },
320 {
322 },
323 {
325 {
335 }
336 },
337 {
339 }
340 }
341 },
342 {
343 &symCmd,
344 {
345 {
347 },
348 {
350 {
352 }
353 },
354 {
356 }
357 }
358 },
359 {
360 &gerberCmd,
361 {
362 {
364 {
365 {
367 }
368 }
369 },
370 {
372 },
373 {
375 }
376 }
377 },
378 {
380 },
381 {
382 // Hidden from --help (set_suppress); invoked by git via the
383 // merge.kicad-*.driver config, not by users.
385 },
386 {
387 &importCmd,
388 },
389 {
390 &versionCmd,
391 },
392 {
394 }
395};
396// clang-format on
397
398
399static void recurseArgParserBuild( argparse::ArgumentParser& aArgParser, COMMAND_ENTRY& aEntry )
400{
401 aArgParser.add_subparser( aEntry.handler->GetArgParser() );
402
403 for( COMMAND_ENTRY& subEntry : aEntry.subCommands )
404 {
405 recurseArgParserBuild( aEntry.handler->GetArgParser(), subEntry );
406 }
407}
408
409
410static COMMAND_ENTRY* recurseArgParserSubCommandUsed( argparse::ArgumentParser& aArgParser, COMMAND_ENTRY& aEntry )
411{
412 COMMAND_ENTRY* cliCmd = nullptr;
413
414 if( aArgParser.is_subcommand_used( aEntry.handler->GetName() ) )
415 {
416 for( COMMAND_ENTRY& subentry : aEntry.subCommands )
417 {
418 cliCmd = recurseArgParserSubCommandUsed( aEntry.handler->GetArgParser(), subentry );
419 if( cliCmd )
420 break;
421 }
422
423 if( !cliCmd )
424 cliCmd = &aEntry;
425 }
426
427 return cliCmd;
428}
429
430
431static void printHelp( argparse::ArgumentParser& argParser )
432{
433 std::stringstream ss;
434 ss << argParser;
435 wxPrintf( From_UTF8( ss.str().c_str() ) );
436}
437
438
445static bool looksLikeNegativeVectorValue( const std::string& aValue )
446{
447 if( aValue.empty() || aValue[0] != '-' )
448 return false;
449
450 if( aValue.find( ',' ) == std::string::npos )
451 return false;
452
453 for( size_t i = 1; i < aValue.size(); ++i )
454 {
455 char c = aValue[i];
456
457 if( !std::isdigit( c ) && c != '.' && c != ',' && c != '-' && c != '+' )
458 return false;
459 }
460
461 return true;
462}
463
464
476static std::vector<std::string> preprocessArgs( int argc, char** argv )
477{
478 std::vector<std::string> result;
479
480 static const std::set<std::string> vectorArgs = { "--rotate", "--pan", "--pivot" };
481
482 for( int i = 0; i < argc; ++i )
483 {
484 std::string current( argv[i] );
485
486 if( vectorArgs.count( current ) && i + 1 < argc )
487 {
488 std::string next( argv[i + 1] );
489
491 {
492 result.push_back( current + "='" + next + "'" );
493 ++i;
494 continue;
495 }
496 }
497
498 result.push_back( current );
499 }
500
501 return result;
502}
503
504
506{
508 App().SetAppDisplayName( wxT( "kicad-cli" ) );
509
510#if defined( DEBUG )
511 wxString absoluteArgv0 = wxStandardPaths::Get().GetExecutablePath();
512
513 if( !wxIsAbsolutePath( absoluteArgv0 ) )
514 {
515 wxLogError( wxT( "No meaningful argv[0]" ) );
516 return false;
517 }
518#endif
519
520 // Initialize the git backend so VCS text-eval functions work in CLI mode
521 SetGitBackend( new LIBGIT_BACKEND() );
522 GetGitBackend()->Init();
523
524 if( !InitPgm( true ) )
525 return false;
526
527 m_bm.InitSettings( new KICAD_SETTINGS );
530 m_bm.Init();
531
533
534 return true;
535}
536
537
539{
540 argparse::ArgumentParser argParser( std::string( "kicad-cli" ), GetMajorMinorVersion().ToStdString(),
541 argparse::default_arguments::none );
542
543 argParser.add_argument( "-v", ARG_VERSION )
544 .help( UTF8STDSTR( _( "prints version information and exits" ) ) )
545 .flag()
546 .nargs( 0 );
547
548 argParser.add_argument( ARG_HELP_SHORT, ARG_HELP ).help( UTF8STDSTR( ARG_HELP_DESC ) ).flag().nargs( 0 );
549
550 for( COMMAND_ENTRY& entry : commandStack )
551 {
552 recurseArgParserBuild( argParser, entry );
553 }
554
555 try
556 {
557 // Use the C locale to parse arguments
558 // Otherwise the decimal separator for the locale will be applied
559 LOCALE_IO dummy;
560
561 // Pre-process arguments to handle negative vector values (e.g., --rotate -45,0,45)
562 // which argparse would otherwise interpret as unknown options
563 std::vector<std::string> args = preprocessArgs( m_argcUtf8, m_argvUtf8 );
564 argParser.parse_args( args );
565 }
566 // std::runtime_error doesn't seem to be enough for the scan<>()
567 catch( const std::exception& err )
568 {
569 bool requestedHelp = false;
570
571 for( int i = 0; i < m_argcUtf8; ++i )
572 {
573 if( std::string arg( m_argvUtf8[i] ); arg == ARG_HELP_SHORT || arg == ARG_HELP )
574 {
575 requestedHelp = true;
576 break;
577 }
578 }
579
580 if( !requestedHelp )
581 wxPrintf( "%s\n", err.what() );
582
583 // find the correct argparser object to output the command usage info
584 COMMAND_ENTRY* cliCmd = nullptr;
585 for( COMMAND_ENTRY& entry : commandStack )
586 {
587 if( argParser.is_subcommand_used( entry.handler->GetName() ) )
588 {
589 cliCmd = recurseArgParserSubCommandUsed( argParser, entry );
590 }
591 }
592
593 // arg parser uses a stream overload for printing the help
594 // we want to intercept so we can wxString the utf8 contents
595 // because on windows our terminal codepage might not be utf8
596 if( cliCmd )
597 cliCmd->handler->PrintHelp();
598 else
599 {
600 printHelp( argParser );
601 }
602
603 return requestedHelp ? 0 : CLI::EXIT_CODES::ERR_ARGS;
604 }
605
606 if( argParser[ARG_HELP] == true )
607 {
608 std::stringstream ss;
609 ss << argParser;
610 wxPrintf( From_UTF8( ss.str().c_str() ) );
611
612 return 0;
613 }
614
615 CLI::COMMAND* cliCmd = nullptr;
616
617 // the version arg gets redirected to the version subcommand
618 if( argParser[ARG_VERSION] == true )
619 {
620 cliCmd = &versionCmd;
621 }
622
623 if( !cliCmd )
624 {
625 for( COMMAND_ENTRY& entry : commandStack )
626 {
627 if( argParser.is_subcommand_used( entry.handler->GetName() ) )
628 {
629 COMMAND_ENTRY* cmdSubEntry = recurseArgParserSubCommandUsed( argParser, entry );
630 if( cmdSubEntry != nullptr )
631 {
632 cliCmd = cmdSubEntry->handler;
633 break;
634 }
635 }
636 }
637 }
638
639 if( cliCmd )
640 {
641 int exitCode = cliCmd->Perform( Kiway );
642
643 if( exitCode != CLI::EXIT_CODES::AVOID_CLOSING )
644 {
645 return exitCode;
646 }
647 else
648 {
649 return 0;
650 }
651 }
652 else
653 {
654 printHelp( argParser );
655
657 }
658}
659
660
662{
663 // Abort and wait on any background jobs
664 GetKiCadThreadPool().purge();
665 GetKiCadThreadPool().wait();
666
668 {
669 if( KIFACE* kiface = Kiway.KiFACE( face, false ) )
670 kiface->Reset();
671 }
672
674 {
676 m_settings_manager->Save();
677
678 // Unload projects while the kiface DRC/ERC severity tables their PROJECT_FILE serializes
679 // against are still alive; deferring to static teardown crashes
680 for( const wxString& projectPath : m_settings_manager->GetOpenProjects() )
681 {
682 if( PROJECT* project = m_settings_manager->GetProject( projectPath ) )
683 m_settings_manager->UnloadProject( project, false );
684 }
685 }
686
688
689 // Release module settings while the settings manager is still available.
690 Destroy();
691
692 m_settings_manager.reset();
693
694 if( GetGitBackend() )
695 {
697 delete GetGitBackend();
698 SetGitBackend( nullptr );
699 }
700
701}
702
703
704void PGM_KICAD::MacOpenFile( const wxString& aFileName )
705{
706#if defined( __WXMAC__ )
707 wxFAIL_MSG( "kicad-cli should not call MacOpenFile" );
708#endif
709}
710
711
713{
714 // unlike a normal destructor, this is designed to be called more
715 // than once safely:
716
717 m_bm.End();
718
720}
721
722
724
726
730struct APP_KICAD_CLI : public wxAppConsole
731{
733 wxAppConsole()
734 {
735 SetPgm( &program );
736
737 // Init the environment each platform wants
739 }
740
741
742 bool OnInit() override
743 {
744 // Perform platform-specific init tasks
745 if( !KIPLATFORM::APP::Init() )
746 return false;
747
748#ifndef DEBUG
749 // Enable logging traces to the console in release build.
750 // This is usually disabled, but it can be useful for users to run to help
751 // debug issues and other problems.
752 if( wxGetEnv( wxS( "KICAD_ENABLE_WXTRACE" ), nullptr ) )
753 {
754 wxLog::EnableLogging( true );
755 wxLog::SetLogLevel( wxLOG_Trace );
756 }
757#endif
758
759 if( !program.OnPgmInit() )
760 {
761 program.OnPgmExit();
762 return false;
763 }
764
765 return true;
766 }
767
768 int OnExit() override
769 {
770 // Drain any pending wx-managed objects before tearing down PGM_BASE
771 // singletons so destructors can still call into Pgm(). See
772 // https://gitlab.com/kicad/code/kicad/-/issues/23373 for the GUI variant
773 // of this hazard; kept consistent with the GUI apps for parity.
774 int ret = wxAppConsole::OnExit();
775
776#if defined( __FreeBSD__ )
777 // Avoid wxLog crashing when used in destructors invoked from OnPgmExit().
778 wxLog::EnableLogging( false );
779#endif
780
781 program.OnPgmExit();
782 return ret;
783 }
784
785 int OnRun() override
786 {
787 try
788 {
789 return program.OnPgmRun();
790 }
791 catch( ... )
792 {
793 Pgm().HandleException( std::current_exception() );
794 }
795
796 return -1;
797 }
798
799 int FilterEvent( wxEvent& aEvent ) override { return Event_Skip; }
800
801#if defined( DEBUG )
805 bool ProcessEvent( wxEvent& aEvent ) override
806 {
807 if( aEvent.GetEventType() == wxEVT_CHAR || aEvent.GetEventType() == wxEVT_CHAR_HOOK )
808 {
809 wxKeyEvent* keyEvent = static_cast<wxKeyEvent*>( &aEvent );
810
811 if( keyEvent )
812 {
813 wxLogTrace( kicadTraceKeyEvent, "APP_KICAD_CLI::ProcessEvent %s", dump( *keyEvent ) );
814 }
815 }
816
817 return wxAppConsole::ProcessEvent( aEvent );
818 }
819
827 bool OnExceptionInMainLoop() override
828 {
829 try
830 {
831 throw;
832 }
833 catch( ... )
834 {
835 Pgm().HandleException( std::current_exception() );
836 }
837
838 return false; // continue on. Return false to abort program
839 }
840#endif
841};
842
843IMPLEMENT_APP_CONSOLE( APP_KICAD_CLI )
844
845
846// The C++ project manager supports one open PROJECT, so Prj() calls within
847// this link image need this function.
849{
850 return Kiway.Prj();
851}
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:48
int Perform(KIWAY &aKiway)
Entry point to processing commands from args and doing work.
Definition command.cpp:56
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
virtual void Reset() override
Reloads global state.
Definition kiface_base.h:51
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
Definition kiway.h:348
virtual KIFACE * KiFACE(FACE_T aFaceId, bool doLoad=true)
Return the KIFACE* given a FACE_T.
Definition kiway.cpp:207
FACE_T
Known KIFACE implementations.
Definition kiway.h:354
@ FACE_SCH
eeschema DSO
Definition kiway.h:355
@ FACE_PCB
pcbnew DSO
Definition kiway.h:356
void OnKiwayEnd()
Definition kiway.cpp:805
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:202
int m_argcUtf8
Definition pgm_base.h:442
std::unique_ptr< SETTINGS_MANAGER > m_settings_manager
Definition pgm_base.h:407
void Destroy()
Definition pgm_base.cpp:183
char ** m_argvUtf8
argv parameters converted to utf8 form because wxWidgets has opinions.
Definition pgm_base.h:440
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:807
void BuildArgvUtf8()
Builds the UTF8 based argv variable.
Definition pgm_base.cpp:273
bool InitPgm(bool aHeadless=false, bool aIsUnitTest=false)
Initialize this program.
Definition pgm_base.cpp:340
virtual SETTINGS_MANAGER & GetSettingsManager() const
Definition pgm_base.h:123
virtual LIBRARY_MANAGER & GetLibraryManager() const
Definition pgm_base.h:125
void SaveCommonSettings()
Save the program (process) settings subset which are stored .kicad_common.
Definition pgm_base.cpp:537
PGM_KICAD extends PGM_BASE to bring in FileHistory() and PdfBrowser() which were moved from EDA_APP i...
Definition pgm_kicad.h:37
bool OnPgmInit()
Definition kicad.cpp:102
void Destroy()
Definition kicad.cpp:533
void MacOpenFile(const wxString &aFileName) override
Specific to MacOSX (not used under Linux or Windows).
Definition kicad.cpp:520
void OnPgmExit()
Definition kicad.cpp:491
APP_SETTINGS_BASE * PgmSettings()
Definition pgm_kicad.h:54
int OnPgmRun()
Definition kicad.cpp:485
BIN_MOD m_bm
Definition pgm_kicad.h:67
Container for project specific data.
Definition project.h:63
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
static std::string ToStdString(const wxString &aStr)
#define _(s)
void SetGitBackend(GIT_BACKEND *aBackend)
GIT_BACKEND * GetGitBackend()
const wxChar *const kicadTraceKeyEvent
Flag to enable wxKeyEvent debug tracing.
static wxString From_UTF8(const char *cstring)
Convert a UTF8 encoded C string to a wxString for all wxWidgets build modes.
Definition idf_helpers.h:44
PROJECT & Prj()
Definition kicad.cpp:733
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::EXPORT_BOM_COMMAND exportSchBomCmd
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::GERBER_CONVERT_PNG_COMMAND gerberConvertPngCmd
static CLI::PCB_EXPORT_IPCD356_COMMAND exportPcbIpcD356Cmd
static CLI::EXPORT_BOM_COMMAND exportPcbBomCmd
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::PCB_EXPORT_IDF_COMMAND exportPcbIdfCmd
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::PCB_EXPORT_STACKUP_COMMAND exportPcbStackupCmd
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:175
#define KFCTL_CLI
Running as CLI app.
Definition kiway.h:176
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
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.
IFACE KIFACE_BASE kiface("pcb_test_frame", KIWAY::FACE_PCB)
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.