Fix the JSON beautifier flag
This commit is contained in:
parent
3c515fcef3
commit
26ea9fc1b8
@ -112,11 +112,12 @@ func (res *Result) CSV() []byte {
|
||||
func (res *Result) JSON() []byte {
|
||||
var data []byte
|
||||
|
||||
if command.Opts.EnablePrettyJson {
|
||||
data, _ = json.MarshalIndent(res.Format(), "", " ")
|
||||
} else {
|
||||
if command.Opts.DisablePrettyJson {
|
||||
data, _ = json.Marshal(res.Format())
|
||||
} else {
|
||||
data, _ = json.MarshalIndent(res.Format(), "", " ")
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ type Options struct {
|
||||
LockSession bool `long:"lock-session" description:"Lock session to a single database connection" default:"false"`
|
||||
Bookmark string `short:"b" long:"bookmark" description:"Bookmark to use for connection. Bookmark files are stored under $HOME/.pgweb/bookmarks/*.toml" default:""`
|
||||
BookmarksDir string `long:"bookmarks-dir" description:"Overrides default directory for bookmark files to search" default:""`
|
||||
EnablePrettyJson bool `long:"feature-pretty-json" description:"Format JSON output" default:"true"`
|
||||
DisablePrettyJson bool `long:"no-pretty-json" description:"Disable JSON formatting feature for result export" default:"false"`
|
||||
}
|
||||
|
||||
var Opts Options
|
||||
|
Loading…
x
Reference in New Issue
Block a user