28#include <wx/filename.h>
31#define ARG_FORMAT "--format"
32#define ARG_REPORT_FORMAT "--report-format"
33#define ARG_REPORT_FILE "--report-file"
34#define ARG_LAYER_MAP "--layer-map"
42 UTF8STDSTR(
_(
"Import a non-KiCad PCB file to KiCad format" ) ) );
45 .default_value( std::string(
"auto" ) )
46 .help(
UTF8STDSTR(
_(
"Input format hint: auto, pads, altium, eagle, cadstar, "
47 "fabmaster, pcad, solidworks (default: auto)" ) ) )
51 .default_value( std::string(
"none" ) )
52 .help(
UTF8STDSTR(
_(
"Import report format: none, json, text (default: none)" ) ) )
56 .default_value( std::string(
"" ) )
57 .help(
UTF8STDSTR(
_(
"File path for import report (default: stdout)" ) ) )
61 .default_value( std::string(
"" ) )
62 .help(
UTF8STDSTR(
_(
"JSON file mapping source layer names to KiCad layer names; "
63 "unmapped layers use the automatic best-guess" ) ) )
70 std::unique_ptr<JOB_PCB_IMPORT> importJob = std::make_unique<JOB_PCB_IMPORT>();
77 if( format == wxS(
"auto" ) )
81 else if( format == wxS(
"pads" ) )
85 else if( format == wxS(
"altium" ) )
89 else if( format == wxS(
"eagle" ) )
93 else if( format == wxS(
"cadstar" ) )
97 else if( format == wxS(
"fabmaster" ) )
101 else if( format == wxS(
"pcad" ) )
105 else if( format == wxS(
"solidworks" ) )
111 wxFprintf( stderr,
_(
"Invalid format: %s\n" ), format );
119 wxFprintf( stderr,
_(
"Invalid report format: %s\n" ), reportFormat );
124 importJob->m_reportFile = reportFile;
128 if( !layerMapFile.IsEmpty() )
134 wxFprintf( stderr, wxS(
"%s\n" ), error );
argparse::ArgumentParser m_argParser
COMMAND(const std::string &aName)
Define a new COMMAND instance.
void addCommonArgs(bool aInput, bool aOutput, IO_TYPE aInputType, IO_TYPE aOutputType)
Set up the most common of args used across cli.
wxString m_argOutput
Value of the output arg if configured.
wxString m_argInput
Value of the common input arg if configured.
int doPerform(KIWAY &aKiway) override
The internal handler that should be overloaded to implement command specific processing and work.
A minimalistic software bus for communications between various DLLs/DSOs (DSOs) within the same KiCad...
int ProcessJob(KIWAY::FACE_T aFace, JOB *aJob, REPORTER *aReporter=nullptr, PROGRESS_REPORTER *aProgressReporter=nullptr)
#define ARG_REPORT_FORMAT
bool ParseImportReportFormat(const wxString &aText, IMPORT_REPORT_FORMAT &aFormat)
Parse the user-facing report format name ("none", "json" or "text") into its enum.
bool LoadLayerMapFile(const wxString &aFile, std::map< wxString, wxString > &aMap, wxString &aError)
Load an explicit layer-mapping file into aMap.
This file contains miscellaneous commonly used macros and functions.
static const int ERR_ARGS
static const int ERR_INVALID_INPUT_FILE
static const int ERR_UNKNOWN_FILE_FORMAT
No plugin for the requested face recognized the input file format.
wxString From_UTF8(const char *cstring)