[studio] Add subcommands output on invalid subcommand dispatch
Build / build (push) Successful in 1m31s

This commit is contained in:
2026-05-29 14:00:27 -05:00
parent e2395411bd
commit 5c9b0be867
2 changed files with 17 additions and 2 deletions
+1 -1
View File
@@ -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);
+16 -1
View File
@@ -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];