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_DROP_APPROXIMATIONS "--drop-approximations"
31#define ARG_REPORT "--report"
38 m_argParser.add_description(
UTF8STDSTR(
_(
"Export a copy of a footprint library readable by an older KiCad "
39 "version. A new --output 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() )
61 .help(
UTF8STDSTR(
_(
"Also write the compatibility report as text to this file" ) ) );
67 std::unique_ptr<JOB_FP_DOWNGRADE> job = std::make_unique<JOB_FP_DOWNGRADE>();
76 if( !wxFileName::Exists( job->m_libraryPath ) )
78 wxFprintf( stderr,
_(
"The footprint library does not exist or is not accessible\n" ) );
84 if( job->m_outputLibraryPath.IsEmpty() )
86 wxFprintf( stderr,
_(
"An output library is required. Use --output.\n" ) );
90 wxFileName input( job->m_libraryPath );
91 wxFileName output( job->m_outputLibraryPath );
93 output.MakeAbsolute();
94 job->m_outputLibraryPath = output.GetFullPath();
96 if( output.SameAs( input ) )
98 wxFprintf( stderr,
_(
"The output must differ from the footprint library.\n" ) );
104 wxString reportError;
108 wxFprintf( stderr, wxS(
"%s\n" ), reportError );
117 wxFprintf( stderr, wxS(
"%s\n" ), reportError );
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
bool ValidateDowngradeReportPath(const wxString &aPath, wxString &aError)
A report destination that is a design or library file is a mistyped path, not a report.
bool WriteDowngradeReport(const COMPATIBILITY_REPORT &aReport, const wxString &aTarget, const wxString &aPath, wxString &aError)
Write the readable compatibility report, the same text the export dialog shows.
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.