chore: Cleaned up code.

This commit is contained in:
2026-06-15 09:26:48 -04:00
parent b47ca8f14d
commit e510f72799
19 changed files with 276 additions and 176 deletions

View File

@@ -56,6 +56,7 @@ COMMANDS := []CommandInfo {
},
}
// FIXME: Works in kinda a wonky and awkward way.
parse_args :: proc(args: []string) -> (cmd: Command, ok: bool) {
if len(args) < 2 || args[1] == "--help" || args[1] == "-h" {
print_usage()
@@ -157,7 +158,12 @@ write_command_help :: proc(name: string, w: io.Writer) -> bool {
fmt.wprintf(w, "\n%s\n", info.long, flush = false)
}
fmt.wprintf(w, "\nFlags:\n -h, --help help for %s\n -c, --config-file <path> config file (default \"~/.envr/config.json\")\n", info.name, flush = false)
fmt.wprintf(
w,
"\nFlags:\n -h, --help help for %s\n -c, --config-file <path> config file (default \"~/.envr/config.json\")\n",
info.name,
flush = false,
)
return true
}
@@ -175,6 +181,7 @@ print_command_help :: proc(name: string) {
bufio.writer_flush(&bw)
}
// TODO: command args should be shown in usage.
write_usage :: proc(w: io.Writer) {
fmt.wprintf(
w,