mirror of
https://github.com/fergalmoran/flameshot.git
synced 2025-12-26 11:50:47 +00:00
Change text references from "arguments" to "subcommands" (#3360)
This commit is contained in:
@@ -24,7 +24,7 @@ auto helpOption =
|
|||||||
CommandOption({ "h", "help" }, QStringLiteral("Displays this help"));
|
CommandOption({ "h", "help" }, QStringLiteral("Displays this help"));
|
||||||
|
|
||||||
QString optionsToString(const QList<CommandOption>& options,
|
QString optionsToString(const QList<CommandOption>& options,
|
||||||
const QList<CommandArgument>& arguments)
|
const QList<CommandArgument>& subcommands)
|
||||||
{
|
{
|
||||||
int size = 0; // track the largest size
|
int size = 0; // track the largest size
|
||||||
QStringList dashedOptionList;
|
QStringList dashedOptionList;
|
||||||
@@ -42,10 +42,10 @@ QString optionsToString(const QList<CommandOption>& options,
|
|||||||
}
|
}
|
||||||
dashedOptionList << joinedDashedOptions;
|
dashedOptionList << joinedDashedOptions;
|
||||||
}
|
}
|
||||||
// check the length of the arguments
|
// check the length of the subcommands
|
||||||
for (auto const& arg : arguments) {
|
for (auto const& subcommand : subcommands) {
|
||||||
if (arg.name().length() > size) {
|
if (subcommand.name().length() > size) {
|
||||||
size = arg.name().length();
|
size = subcommand.name().length();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// generate the text
|
// generate the text
|
||||||
@@ -60,17 +60,17 @@ QString optionsToString(const QList<CommandOption>& options,
|
|||||||
.arg(options.at(i).description().replace(
|
.arg(options.at(i).description().replace(
|
||||||
QLatin1String("\n"), linePadding));
|
QLatin1String("\n"), linePadding));
|
||||||
}
|
}
|
||||||
if (!arguments.isEmpty()) {
|
if (!subcommands.isEmpty()) {
|
||||||
result += QLatin1String("\n");
|
result += QLatin1String("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!arguments.isEmpty()) {
|
if (!subcommands.isEmpty()) {
|
||||||
result += QObject::tr("Arguments") + ":\n";
|
result += QObject::tr("Subcommands") + ":\n";
|
||||||
}
|
}
|
||||||
for (const auto& argument : arguments) {
|
for (const auto& subcommand : subcommands) {
|
||||||
result += QStringLiteral(" %1 %2\n")
|
result += QStringLiteral(" %1 %2\n")
|
||||||
.arg(argument.name().leftJustified(size, ' '))
|
.arg(subcommand.name().leftJustified(size, ' '))
|
||||||
.arg(argument.description());
|
.arg(subcommand.description());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -326,7 +326,7 @@ void CommandLineParser::printHelp(QStringList args, const Node* node)
|
|||||||
argName = qApp->applicationName();
|
argName = qApp->applicationName();
|
||||||
}
|
}
|
||||||
QString argText =
|
QString argText =
|
||||||
node->subNodes.isEmpty() ? "" : "[" + QObject::tr("arguments") + "]";
|
node->subNodes.isEmpty() ? "" : "[" + QObject::tr("subcommands") + "]";
|
||||||
helpText += (QObject::tr("Usage") + ": %1 [%2-" + QObject::tr("options") +
|
helpText += (QObject::tr("Usage") + ": %1 [%2-" + QObject::tr("options") +
|
||||||
QStringLiteral("] %3\n\n"))
|
QStringLiteral("] %3\n\n"))
|
||||||
.arg(args.join(QStringLiteral(" ")))
|
.arg(args.join(QStringLiteral(" ")))
|
||||||
@@ -339,9 +339,9 @@ void CommandLineParser::printHelp(QStringList args, const Node* node)
|
|||||||
helpText += "\n\n";
|
helpText += "\n\n";
|
||||||
|
|
||||||
// add command options and subarguments
|
// add command options and subarguments
|
||||||
QList<CommandArgument> subArgs;
|
QList<CommandArgument> subcommands;
|
||||||
for (const Node& n : node->subNodes) {
|
for (const Node& n : node->subNodes) {
|
||||||
subArgs.append(n.argument);
|
subcommands.append(n.argument);
|
||||||
}
|
}
|
||||||
auto modifiedOptions = node->options;
|
auto modifiedOptions = node->options;
|
||||||
if (m_withHelp) {
|
if (m_withHelp) {
|
||||||
@@ -350,7 +350,7 @@ void CommandLineParser::printHelp(QStringList args, const Node* node)
|
|||||||
if (m_withVersion && node == &m_parseTree) {
|
if (m_withVersion && node == &m_parseTree) {
|
||||||
modifiedOptions << versionOption;
|
modifiedOptions << versionOption;
|
||||||
}
|
}
|
||||||
helpText += optionsToString(modifiedOptions, subArgs);
|
helpText += optionsToString(modifiedOptions, subcommands);
|
||||||
// print it
|
// print it
|
||||||
out << helpText;
|
out << helpText;
|
||||||
}
|
}
|
||||||
|
|||||||
10
src/main.cpp
10
src/main.cpp
@@ -173,8 +173,9 @@ int main(int argc, char* argv[])
|
|||||||
QObject::tr("Powerful yet simple to use screenshot software."));
|
QObject::tr("Powerful yet simple to use screenshot software."));
|
||||||
parser.setGeneralErrorMessage(QObject::tr("See") + " flameshot --help.");
|
parser.setGeneralErrorMessage(QObject::tr("See") + " flameshot --help.");
|
||||||
// Arguments
|
// Arguments
|
||||||
CommandArgument fullArgument(QStringLiteral("full"),
|
CommandArgument fullArgument(
|
||||||
QObject::tr("Capture the entire desktop."));
|
QStringLiteral("full"),
|
||||||
|
QObject::tr("Capture screenshot of all monitors at the same time."));
|
||||||
CommandArgument launcherArgument(QStringLiteral("launcher"),
|
CommandArgument launcherArgument(QStringLiteral("launcher"),
|
||||||
QObject::tr("Open the capture launcher."));
|
QObject::tr("Open the capture launcher."));
|
||||||
CommandArgument guiArgument(
|
CommandArgument guiArgument(
|
||||||
@@ -182,8 +183,9 @@ int main(int argc, char* argv[])
|
|||||||
QObject::tr("Start a manual capture in GUI mode."));
|
QObject::tr("Start a manual capture in GUI mode."));
|
||||||
CommandArgument configArgument(QStringLiteral("config"),
|
CommandArgument configArgument(QStringLiteral("config"),
|
||||||
QObject::tr("Configure") + " flameshot.");
|
QObject::tr("Configure") + " flameshot.");
|
||||||
CommandArgument screenArgument(QStringLiteral("screen"),
|
CommandArgument screenArgument(
|
||||||
QObject::tr("Capture a single screen."));
|
QStringLiteral("screen"),
|
||||||
|
QObject::tr("Capture a screenshot of the specified monitor."));
|
||||||
|
|
||||||
// Options
|
// Options
|
||||||
CommandOption pathOption(
|
CommandOption pathOption(
|
||||||
|
|||||||
Reference in New Issue
Block a user