test: commands now accept stdout/stderr fields.

This commit is contained in:
2026-06-15 17:00:45 -04:00
parent ec96dff055
commit 4600c81401
18 changed files with 157 additions and 160 deletions

View File

@@ -6,13 +6,13 @@ import "core:strings"
cmd_remove :: proc(cmd: ^Command) {
if len(cmd.args) != 1 {
print_command_help("remove")
print_command_help(cmd)
return
}
path := cmd.args[0]
if len(strings.trim_space(path)) == 0 {
fmt.println("Error: No path provided")
fmt.wprintln(cmd.err, "Error: No path provided", flush = false)
return
}
@@ -23,7 +23,7 @@ cmd_remove :: proc(cmd: ^Command) {
} else {
resolved, abs_err := filepath.abs(path)
if abs_err != nil {
fmt.printf("Error getting absolute path: %v\n", abs_err)
fmt.wprintf(cmd.err, "Error getting absolute path: %v\n", abs_err, flush = false)
return
}
abs_path = resolved
@@ -39,6 +39,6 @@ cmd_remove :: proc(cmd: ^Command) {
return
}
fmt.printf("Removed %s from the database\n", abs_path)
fmt.wprintf(cmd.out, "Removed %s from the database\n", abs_path, flush = false)
}