MCPcopy Create free account
hub / github.com/LibrePCB/LibrePCB / execute

Method execute

apps/librepcb-cli/commandlineinterface.cpp:87–579  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85 ******************************************************************************/
86
87int CommandLineInterface::execute(const QStringList& args) noexcept {
88 QStringList positionalArgNames;
89 QMap<QString, QPair<QString, QString>> commands = {
90 {"open-project",
91 {tr("Open a project to execute project-related tasks."),
92 "open-project [command_options]"}}, // no tr()!
93 {"open-library",
94 {tr("Open a library to execute library-related tasks."),
95 "open-library [command_options]"}}, // no tr()!
96 {"open-symbol",
97 {tr("Open a symbol to execute symbol-related tasks."),
98 "open-symbol [command_options]"}}, // no tr()!
99 {"open-package",
100 {tr("Open a package to execute package-related tasks."),
101 "open-package [command_options]"}}, // no tr()!
102 {"open-step",
103 {tr("Open a STEP model to execute STEP-related tasks outside of a "
104 "library."),
105 "open-step [command_options]"}}, // no tr()!
106 };
107
108 // Add global options
109 QCommandLineParser parser;
110 parser.setApplicationDescription(tr("LibrePCB Command Line Interface"));
111 // Don't use the built-in addHelpOption() since it also adds the "--help-all"
112 // option which we don't need, and the OS-dependent option "-?".
113 const QCommandLineOption helpOption({"h", "help"}, tr("Print this message."));
114 parser.addOption(helpOption);
115 const QCommandLineOption versionOption({"V", "version"},
116 tr("Displays version information."));
117 parser.addOption(versionOption);
118 QCommandLineOption verboseOption({"v", "verbose"}, tr("Verbose output."));
119 parser.addOption(verboseOption);
120 parser.addPositionalArgument("command",
121 tr("The command to execute (see list below)."));
122 positionalArgNames.append("command");
123
124 // Define options for "open-project"
125 QCommandLineOption ercOption(
126 "erc",
127 tr("Run the electrical rule check, print all non-approved "
128 "warnings/errors and "
129 "report failure (exit code = 1) if there are non-approved messages."));
130 QCommandLineOption drcOption(
131 "drc",
132 tr("Run the design rule check, print all non-approved warnings/errors "
133 "and report failure (exit code = 1) if there are non-approved "
134 "messages."));
135 QCommandLineOption drcSettingsOption(
136 "drc-settings",
137 tr("Override DRC settings by providing a *.lp file containing custom "
138 "settings. If not set, the settings from the boards will be used "
139 "instead."),
140 tr("file"));
141 QCommandLineOption runSpecificJobOption(
142 "run-job",
143 tr("Run a particular output job. Can be given multiple times to run "
144 "multiple jobs."),

Callers 1

mainFunction · 0.45

Calls 15

QStringClass · 0.85
joinMethod · 0.80
setDebugLevelStderrMethod · 0.80
addOptionMethod · 0.45
appendMethod · 0.45
setDescriptionMethod · 0.45
valueMethod · 0.45
insertMethod · 0.45
splitMethod · 0.45
parseMethod · 0.45
isEmptyMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected