24#ifndef KICAD_CLI_COMMAND_DIFF_BASE_H
25#define KICAD_CLI_COMMAND_DIFF_BASE_H
52template <
typename JOB_T>
56 DIFF_COMMAND(
const wxString& aDescription,
const std::string& aArgA,
const wxString& aHelpA,
57 const std::string& aMetaA,
const std::string& aArgB,
const wxString& aHelpB,
70 .default_value( std::string(
"json" ) )
71 .
help(
UTF8STDSTR(
_(
"Output format: json, text, png, or svg (default: json)" ) ) )
75 .default_value( std::string(
"" ) )
76 .
help(
UTF8STDSTR(
_(
"Output file path; required for png/svg, otherwise prints to "
77 "stdout if omitted" ) ) )
81 .
help(
UTF8STDSTR(
_(
"Only set exit code (0=identical, 5=differences found, "
82 "non-zero on error), no output" ) ) )
89 std::unique_ptr<JOB_T> job = std::make_unique<JOB_T>();
93 job->m_exitCodeOnly =
m_argParser.get<
bool>(
"--exit-code-only" );
97 std::string fmt =
m_argParser.get<std::string>(
"--format" );
106 && job->GetConfiguredOutputPath().IsEmpty() )
108 wxFprintf( stderr,
_(
"--output is required for png/svg formats\n" ) );
argparse::ArgumentParser m_argParser
COMMAND(const std::string &aName)
Define a new COMMAND instance.
DIFF_COMMAND(const wxString &aDescription, const std::string &aArgA, const wxString &aHelpA, const std::string &aMetaA, const std::string &aArgB, const wxString &aHelpB, const std::string &aMetaB, KIWAY::FACE_T aFace)
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)
FACE_T
Known KIFACE implementations.
static const int ERR_ARGS
bool DiffOutputFormatRequiresOutputPath(Format aFormat)
void ReportInvalidDiffOutputFormat(const std::string &aText)
bool ParseDiffOutputFormat(const std::string &aText, Format &aOut)
wxString From_UTF8(const char *cstring)