mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-01 19:17:58 +00:00
Output JSON with spaces not tabs
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
package command
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -53,17 +52,15 @@ var Formatters = map[string]Formatter{
|
||||
}
|
||||
|
||||
// An output formatter for json output of an object
|
||||
type JsonFormatter struct {
|
||||
}
|
||||
type JsonFormatter struct{}
|
||||
|
||||
func (j JsonFormatter) Output(ui cli.Ui, secret *api.Secret, data interface{}) error {
|
||||
b, err := json.Marshal(data)
|
||||
if err == nil {
|
||||
var out bytes.Buffer
|
||||
json.Indent(&out, b, "", "\t")
|
||||
ui.Output(out.String())
|
||||
b, err := json.MarshalIndent(data, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return err
|
||||
ui.Output(string(b))
|
||||
return nil
|
||||
}
|
||||
|
||||
// An output formatter for yaml output format of an object
|
||||
|
||||
Reference in New Issue
Block a user