25#include <wx/filename.h>
27#define ARG_TARGET "--target"
28#define ARG_FORCE "--force"
29#define ARG_DRY_RUN "--dry-run"
30#define ARG_LIBRARIES "--libraries"
31#define ARG_VARIANT "--variant"
32#define ARG_DROP_APPROXIMATIONS "--drop-approximations"
38 m_argParser.add_description(
UTF8STDSTR(
_(
"Export a copy of the schematic readable by an older KiCad version. "
39 "A new --output folder is required except for --dry-run." ) ) );
42 .default_value( std::string() )
44 _(
"Target version name or id, e.g. \"KiCad 10.0\" or \"10.0\". Defaults to the newest." ) ) );
47 .help(
UTF8STDSTR(
_(
"Export even if some features must be dropped or approximated" ) ) )
51 .help(
UTF8STDSTR(
_(
"Print the compatibility report without writing anything" ) ) )
56 _(
"Omit features instead of approximating them; may remove drawing or electrical data" ) ) )
60 .default_value( std::string() )
62 _(
"Copy this symbol-library folder into the output folder and downgrade the copies" ) ) );
65 .default_value( std::string() )
66 .help(
UTF8STDSTR(
_(
"Flatten this variant into the export. Default is the base design." ) ) );
71 std::unique_ptr<JOB_SCH_DOWNGRADE> job = std::make_unique<JOB_SCH_DOWNGRADE>();
82 if( !wxFile::Exists( job->m_filename ) )
84 wxFprintf( stderr,
_(
"Schematic file does not exist or is not accessible\n" ) );
88 if( !job->m_dryRun && job->m_outputDir.IsEmpty() )
90 wxFprintf( stderr,
_(
"An output folder is required. Use --output.\n" ) );
94 if( !job->m_outputDir.IsEmpty() && !job->m_dryRun )
96 wxFileName inFn( job->m_filename );
97 wxFileName outDir( job->m_outputDir, wxEmptyString );
99 outDir.MakeAbsolute();
100 job->m_outputDir = outDir.GetPath();
102 wxFileName inDir( inFn.GetPath(), wxEmptyString );
104 if( outDir.SameAs( inDir ) )
106 wxFprintf( stderr,
_(
"The output folder must differ from the schematic folder.\n" ) );
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.
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_DROP_APPROXIMATIONS
static const int ERR_ARGS
static const int ERR_INVALID_INPUT_FILE
int doPerform(KIWAY &aKiway) override
The internal handler that should be overloaded to implement command specific processing and work.