[studio] Add subcommands output on invalid subcommand dispatch
Build / build (push) Successful in 1m31s
Build / build (push) Successful in 1m31s
This commit is contained in:
@@ -77,7 +77,7 @@ int main(int const argc, char const **argv) {
|
|||||||
OLYMPIC_PROJECT_DATADIR,
|
OLYMPIC_PROJECT_DATADIR,
|
||||||
{argv, static_cast<size_t>(argc)});
|
{argv, static_cast<size_t>(argc)});
|
||||||
oxAssert(err, "Something went wrong...");
|
oxAssert(err, "Something went wrong...");
|
||||||
if (err) {
|
if (ox::defines::Debug && err) {
|
||||||
oxErrf("Failure: {}\n", toStr(err));
|
oxErrf("Failure: {}\n", toStr(err));
|
||||||
}
|
}
|
||||||
return static_cast<int>(err);
|
return static_cast<int>(err);
|
||||||
|
|||||||
@@ -116,6 +116,20 @@ static ox::Error runStudio(
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void listCmds() noexcept {
|
||||||
|
oxOut("Insufficient arguments for sub-command\n\nValid commands:\n\n");
|
||||||
|
for (auto const m : modules()) {
|
||||||
|
if (m->commands().empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
oxOutf("\t{}\n", m->id());
|
||||||
|
for (auto const &c : m->commands()) {
|
||||||
|
oxOutf("\t\t{}\n", c.name);
|
||||||
|
}
|
||||||
|
oxOut("\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static ox::Error run(
|
static ox::Error run(
|
||||||
ox::StringViewCR appName,
|
ox::StringViewCR appName,
|
||||||
ox::StringViewCR projectDataDir,
|
ox::StringViewCR projectDataDir,
|
||||||
@@ -130,7 +144,8 @@ static ox::Error run(
|
|||||||
});
|
});
|
||||||
if (args.size() > 1 && ox::StringView{args[1]} == "cmd") {
|
if (args.size() > 1 && ox::StringView{args[1]} == "cmd") {
|
||||||
if (args.size() < 5) {
|
if (args.size() < 5) {
|
||||||
return ox::Error{1, "insufficient arguments for sub-command"};
|
listCmds();
|
||||||
|
return ox::Error{1};
|
||||||
}
|
}
|
||||||
auto constexpr numCmdArgs = 5;
|
auto constexpr numCmdArgs = 5;
|
||||||
ox::StringView const projectDir = args[2];
|
ox::StringView const projectDir = args[2];
|
||||||
|
|||||||
Reference in New Issue
Block a user