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