~sircmpwn/hare unlisted

c34cc1d53b783a960d85892837430dfa90f4885c — Drew DeVault 2 months ago bc6041a
cmd/hare: simplify main.ha

Signed-off-by: Drew DeVault <sir@cmpwn.com>
1 files changed, 12 insertions(+), 9 deletions(-)

M cmd/hare/main.ha
M cmd/hare/main.ha => cmd/hare/main.ha +12 -9
@@ 16,14 16,17 @@ export fn main() void = {
		getopt::printusage(os::stderr, os::args[0], help...);
		os::exit(1);
	};
	if (cmd.args[0] == "build") build(cmd.args)
	else if (cmd.args[0] == "cache") cache(cmd.args)
	else if (cmd.args[0] == "deps") deps(cmd.args)
	else if (cmd.args[0] == "run") run(cmd.args)
	else if (cmd.args[0] == "test") test(cmd.args)
	else if (cmd.args[0] == "version") version(cmd.args)
	else {
		getopt::printusage(os::stderr, os::args[0], help...);
		os::exit(1);
	const task = switch (cmd.args[0]) {
		"build" => &build,
		"cache" => &cache,
		"deps" => &deps,
		"run" => &run,
		"test" => &test,
		"version" => &version,
		* => {
			getopt::printusage(os::stderr, os::args[0], help...);
			os::exit(1);
		},
	};
	task(cmd.args);
};