diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt
index 962f623033..35f830ec9f 100644
--- a/kicad/CMakeLists.txt
+++ b/kicad/CMakeLists.txt
@@ -16,6 +16,7 @@ include_directories(
)
set( KICAD_SRCS
+ cli/command.cpp
cli/command_export_pcb_base.cpp
cli/command_export_pcb_drill.cpp
cli/command_export_pcb_dxf.cpp
@@ -24,15 +25,12 @@ set( KICAD_SRCS
cli/command_export_pcb_pos.cpp
cli/command_export_pcb_step.cpp
cli/command_export_pcb_svg.cpp
- cli/command_fp.cpp
cli/command_fp_upgrade.cpp
- cli/command_pcb.cpp
cli/command_pcb_export.cpp
cli/command_export_sch_bom.cpp
cli/command_export_sch_netlist.cpp
cli/command_export_sch_pdf.cpp
cli/command_export_sch_svg.cpp
- cli/command_sch.cpp
cli/command_sch_export.cpp
dialogs/dialog_template_selector_base.cpp
dialogs/dialog_template_selector.cpp
diff --git a/kicad/cli/command_fp.cpp b/kicad/cli/command.cpp
similarity index 76%
rename from kicad/cli/command_fp.cpp
rename to kicad/cli/command.cpp
index d57fe03367..9dd1945229 100644
--- a/kicad/cli/command_fp.cpp
+++ b/kicad/cli/command.cpp
@@ -18,15 +18,18 @@
* with this program. If not, see .
*/
-#include "command_fp.h"
+#include "command.h"
+#include
+#include
+#include
-CLI::FP_COMMAND::FP_COMMAND() : COMMAND( "fp" )
+#include
+
+int CLI::COMMAND::Perform( KIWAY& aKiway )
{
-}
+ std::stringstream ss;
+ ss << m_argParser;
+ wxPrintf( FROM_UTF8( ss.str().c_str() ) );
-int CLI::FP_COMMAND::Perform( KIWAY& aKiway )
-{
- std::cout << m_argParser;
-
- return 1;
+ return EXIT_CODES::OK;
}
\ No newline at end of file
diff --git a/kicad/cli/command.h b/kicad/cli/command.h
index d535e8b29a..da288ed454 100644
--- a/kicad/cli/command.h
+++ b/kicad/cli/command.h
@@ -37,7 +37,7 @@ public:
m_name( aName ),
m_argParser( aName, "", aDefaultArgs ){};
- virtual int Perform( KIWAY& aKiway ) = 0;
+ virtual int Perform( KIWAY& aKiway );
virtual ~COMMAND() = default;
diff --git a/kicad/cli/command_fp.h b/kicad/cli/command_fp.h
index dbc6273a96..013d3ef81d 100644
--- a/kicad/cli/command_fp.h
+++ b/kicad/cli/command_fp.h
@@ -27,9 +27,7 @@ namespace CLI
{
struct FP_COMMAND : public COMMAND
{
- FP_COMMAND();
-
- int Perform( KIWAY& aKiway ) override;
+ FP_COMMAND() : COMMAND( "fp" ) {}
};
}
diff --git a/kicad/cli/command_pcb.cpp b/kicad/cli/command_pcb.cpp
deleted file mode 100644
index 5c13250428..0000000000
--- a/kicad/cli/command_pcb.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2022 Mark Roszko
- * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see .
- */
-
-#include "command_pcb.h"
-
-CLI::PCB_COMMAND::PCB_COMMAND() : COMMAND( "pcb" )
-{
-}
-
-int CLI::PCB_COMMAND::Perform( KIWAY& aKiway )
-{
- std::cout << m_argParser;
-
- return 1;
-}
\ No newline at end of file
diff --git a/kicad/cli/command_pcb.h b/kicad/cli/command_pcb.h
index f7fa12a2e1..78ec3303d5 100644
--- a/kicad/cli/command_pcb.h
+++ b/kicad/cli/command_pcb.h
@@ -27,9 +27,7 @@ namespace CLI
{
struct PCB_COMMAND : public COMMAND
{
- PCB_COMMAND();
-
- int Perform( KIWAY& aKiway ) override;
+ PCB_COMMAND() : COMMAND( "pcb" ) {}
};
}
diff --git a/kicad/cli/command_sch.cpp b/kicad/cli/command_sch.cpp
deleted file mode 100644
index 18ecf06f1d..0000000000
--- a/kicad/cli/command_sch.cpp
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This program source code file is part of KiCad, a free EDA CAD application.
- *
- * Copyright (C) 2022 Mark Roszko
- * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
- *
- * This program is free software: you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation, either version 3 of the License, or (at your
- * option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program. If not, see .
- */
-
-#include "command_sch.h"
-
-CLI::SCH_COMMAND::SCH_COMMAND() : COMMAND( "sch" )
-{
-}
-
-int CLI::SCH_COMMAND::Perform( KIWAY& aKiway )
-{
- std::cout << m_argParser;
-
- return 1;
-}
\ No newline at end of file
diff --git a/kicad/cli/command_sch.h b/kicad/cli/command_sch.h
index c0a564c3f9..8b16f62627 100644
--- a/kicad/cli/command_sch.h
+++ b/kicad/cli/command_sch.h
@@ -27,9 +27,7 @@ namespace CLI
{
struct SCH_COMMAND : public COMMAND
{
- SCH_COMMAND();
-
- int Perform( KIWAY& aKiway ) override;
+ SCH_COMMAND() : COMMAND( "sch" ) { }
};
}