diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-03-05 18:44:13 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-03-05 18:44:13 -0500 |
| commit | 59a0fe7c13541921985d39df446d0aec480bb448 (patch) | |
| tree | a846e4d3f6dd24d7cab8b3e02bfac57effbc8c92 | |
| parent | 147e0f0269440fce15d6b88a8a90627f3a3b2df2 (diff) | |
Better error reporting/defaults for `-C` flag
| -rw-r--r-- | tomo.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -124,6 +124,9 @@ int main(int argc, char *argv[]) {"quiet", false, &Bool$info, &quiet}, {"q", false, &Bool$info, &quiet}, ); + + if (show_codegen.length > 0 && Text$equal_values(show_codegen, Text("pretty"))) + show_codegen = Text("sed '/^#line/d;/^$/d' | indent -o /dev/stdout | bat -l c -P"); if (uninstall) { for (int64_t i = 0; i < files.length; i++) { @@ -150,6 +153,8 @@ int main(int argc, char *argv[]) free(cwd); return 0; } else if (files.length == 0) { + if (show_codegen.length >= 0) + errx(1, "You specified to show codegen with the tool `%k` but didn't give any files", &show_codegen); repl(); return 0; } @@ -532,7 +537,7 @@ void transpile_header(env_t *base_env, Text_t filename, bool force_retranspile) printf("\x1b[2mTranspiled to %k\x1b[m\n", &h_filename); if (show_codegen.length > 0) - system(heap_strf("%k %k", &show_codegen, &h_filename)); + system(heap_strf("<%k %k", &h_filename, &show_codegen)); } void transpile_code(env_t *base_env, Text_t filename, bool force_retranspile) @@ -575,7 +580,7 @@ void transpile_code(env_t *base_env, Text_t filename, bool force_retranspile) printf("\x1b[2mTranspiled to %k\x1b[m\n", &c_filename); if (show_codegen.length > 0) - system(heap_strf("%k %k", &show_codegen, &c_filename)); + system(heap_strf("<%k %k", &c_filename, &show_codegen)); } void compile_object_file(Text_t filename, bool force_recompile) |
