mirror of
https://github.com/sbrow/envr.git
synced 2026-06-27 10:38:33 -04:00
test: commands now accept stdout/stderr fields.
This commit is contained in:
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import "core:encoding/json"
|
||||
import "core:fmt"
|
||||
import "core:io"
|
||||
import "core:os"
|
||||
import "core:path/filepath"
|
||||
import "core:strings"
|
||||
@@ -41,8 +40,7 @@ cmd_list :: proc(cmd: ^Command) {
|
||||
append(&table_rows, row_slice)
|
||||
}
|
||||
|
||||
w := io.to_writer(os.to_writer(os.stdout))
|
||||
render_table(w, headers, table_rows[:])
|
||||
render_table(cmd.out, headers, table_rows[:])
|
||||
} else {
|
||||
// TODO: Should we instead print full entries here?
|
||||
entries: [dynamic]ListEntry
|
||||
@@ -59,10 +57,10 @@ cmd_list :: proc(cmd: ^Command) {
|
||||
|
||||
data, marshal_err := json.marshal(entries[:], allocator = context.temp_allocator)
|
||||
if marshal_err != nil {
|
||||
fmt.printf("Error marshaling JSON: %v\n", marshal_err)
|
||||
fmt.wprintf(cmd.err, "Error marshaling JSON: %v\n", marshal_err, flush = false)
|
||||
return
|
||||
}
|
||||
fmt.println(string(data))
|
||||
fmt.wprintln(cmd.out, string(data), flush = false)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user