mirror of
https://github.com/sbrow/envr.git
synced 2026-06-28 02:58:33 -04:00
feat: Added --format, -f flag.
Allows printing data in tabular or json format.
This commit is contained in:
@@ -361,3 +361,43 @@ test_parse_args_config_file_defaults :: proc(t: ^testing.T) {
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_get_format_long_json :: proc(t: ^testing.T) {
|
||||
cmd, ok, _, _ := test_parse_args([]string{"envr", "list", "--format", "json"})
|
||||
testing.expect(t, ok, "should succeed")
|
||||
if !ok do return
|
||||
defer delete_command(&cmd)
|
||||
|
||||
testing.expect_value(t, get_format(&cmd), Output_Format.JSON)
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_get_format_short_json :: proc(t: ^testing.T) {
|
||||
cmd, ok, _, _ := test_parse_args([]string{"envr", "list", "-f", "json"})
|
||||
testing.expect(t, ok, "should succeed")
|
||||
if !ok do return
|
||||
defer delete_command(&cmd)
|
||||
|
||||
testing.expect_value(t, get_format(&cmd), Output_Format.JSON)
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_get_format_long_table :: proc(t: ^testing.T) {
|
||||
cmd, ok, _, _ := test_parse_args([]string{"envr", "list", "--format", "table"})
|
||||
testing.expect(t, ok, "should succeed")
|
||||
if !ok do return
|
||||
defer delete_command(&cmd)
|
||||
|
||||
testing.expect_value(t, get_format(&cmd), Output_Format.Table)
|
||||
}
|
||||
|
||||
@(test)
|
||||
test_get_format_short_table :: proc(t: ^testing.T) {
|
||||
cmd, ok, _, _ := test_parse_args([]string{"envr", "list", "-f", "table"})
|
||||
testing.expect(t, ok, "should succeed")
|
||||
if !ok do return
|
||||
defer delete_command(&cmd)
|
||||
|
||||
testing.expect_value(t, get_format(&cmd), Output_Format.Table)
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user