feat: add json output for list and view commands
This commit is contained in:
parent
fe23f2fce3
commit
3ccef4e1c6
5 changed files with 192 additions and 52 deletions
12
cmd/json.go
Normal file
12
cmd/json.go
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
)
|
||||
|
||||
func writeJSON(value any) error {
|
||||
enc := json.NewEncoder(os.Stdout)
|
||||
enc.SetIndent("", " ")
|
||||
return enc.Encode(value)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue