core/command: make log --file positional

Also frees up -f for --follow.
This commit is contained in:
outfoxxed 2024-09-10 04:55:44 -07:00
parent 01deefe241
commit 47ec85ffef
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E

View file

@ -243,17 +243,17 @@ int runCommand(int argc, char** argv, QCoreApplication* coreApplication) {
{ {
auto* sub = cli.add_subcommand("log", "Read quickshell logs.\n") auto* sub = cli.add_subcommand("log", "Read quickshell logs.\n")
->description("If --file is specified, the given file will be read.\n" ->description("If file is specified, the given file will be read.\n"
"If not, the log of the first launched instance matching" "If not, the log of the first launched instance matching"
"the instance selection flags will be read."); "the instance selection flags will be read.");
auto* file = sub->add_option("--file", state.log.file, "Log file to read."); auto* file = sub->add_option("file", state.log.file, "Log file to read.");
sub->add_option("-t,--tail", state.log.tail) sub->add_option("-t,--tail", state.log.tail)
->description("Maximum number of lines to print, starting from the bottom.") ->description("Maximum number of lines to print, starting from the bottom.")
->check(CLI::Range(1, std::numeric_limits<int>::max(), "INT > 0")); ->check(CLI::Range(1, std::numeric_limits<int>::max(), "INT > 0"));
sub->add_flag("--follow", state.log.follow) sub->add_flag("-f,--follow", state.log.follow)
->description("Keep reading the log until the logging process terminates."); ->description("Keep reading the log until the logging process terminates.");
sub->add_option("-r,--rules", state.log.readoutRules, "Log file to read.") sub->add_option("-r,--rules", state.log.readoutRules, "Log file to read.")