mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 17:52:02 +02:00
Fix output format not being respected for STDOUT
This commit is contained in:
@@ -315,6 +315,7 @@ func (h *Handler) OnInitialize() (ans string, err error) {
|
||||
err = h.graphics_handler.Initialize(h.lp)
|
||||
h.result_manager.set_root_dir()
|
||||
h.draw_screen()
|
||||
h.lp.SendOverlayReady()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -772,16 +773,16 @@ func main(_ *cli.Command, opts *Options, args []string) (rc int, err error) {
|
||||
return
|
||||
}
|
||||
m := strings.Join(selections, "\n")
|
||||
if opts.OutputFormat == "json" {
|
||||
payload["paths"] = selections
|
||||
if current_filter != "" {
|
||||
payload["current_filter"] = current_filter
|
||||
}
|
||||
b, _ := json.MarshalIndent(payload, "", " ")
|
||||
m = string(b)
|
||||
}
|
||||
fmt.Print(m)
|
||||
if opts.WriteOutputTo != "" {
|
||||
if opts.OutputFormat == "json" {
|
||||
payload["paths"] = selections
|
||||
if current_filter != "" {
|
||||
payload["current_filter"] = current_filter
|
||||
}
|
||||
b, _ := json.MarshalIndent(payload, "", " ")
|
||||
m = string(b)
|
||||
}
|
||||
os.WriteFile(opts.WriteOutputTo, []byte(m), 0600)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user