Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ You can provide the input JSON or NDJSON either through a file or via standard i
if err != nil {
return err
}
bubble, err := jqplayground.New(stdin, "STDIN", query, jqtheme)
bubble, err := jqplayground.New(stdin, "STDIN", query, jqtheme, flags.showInputPanel)
if err != nil {
return err
}
Expand Down Expand Up @@ -102,7 +102,7 @@ You can provide the input JSON or NDJSON either through a file or via standard i
return err
}

bubble, err := jqplayground.New(data, fi.Name(), query, jqtheme)
bubble, err := jqplayground.New(data, fi.Name(), query, jqtheme, flags.showInputPanel)
if err != nil {
return err
}
Expand Down Expand Up @@ -154,15 +154,18 @@ func initConfig() {

var flags struct {
filepath, theme string
showInputPanel bool
}

var flagsName = struct {
file, fileShort, theme, themeShort string
file, fileShort, theme, themeShort, showInputPanel, showInputPanelShort string
}{
file: "file",
fileShort: "f",
theme: "theme",
themeShort: "t",
file: "file",
fileShort: "f",
theme: "theme",
themeShort: "t",
showInputPanel: "show-input-panel",
showInputPanelShort: "i",
}

var configKeysName = struct {
Expand Down Expand Up @@ -194,5 +197,7 @@ func Execute() error {
flagsName.themeShort,
"", "jqp theme")

rootCmd.Flags().BoolVarP(&flags.showInputPanel, flagsName.showInputPanel, flagsName.showInputPanelShort, true, "show input panel")

return rootCmd.Execute()
}
13 changes: 7 additions & 6 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,13 @@ description: |
jqp [query] [flags]

Flags:
--config string path to config file (default is $HOME/.jqp.yaml)
-f, --file string path to the input JSON file
-h, --help help for jqp
-t, --theme string jqp theme
-v, --version version for jqp

--config string path to config file (default is $HOME/.jqp.yaml)
-f, --file string path to the input JSON file
-h, --help help for jqp
-i, --show-input-panel show input panel (default true)
-t, --theme string jqp theme
-v, --version version for jqp

license: MIT
issues: https://github.com/kz6fittycent/jqp
contact: https://github.com/kz6fittycent/jqp
Expand Down
4 changes: 2 additions & 2 deletions tui/bubbles/help/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type Bubble struct {
showInputPanel bool
}

func New(jqtheme theme.Theme) Bubble {
func New(jqtheme theme.Theme, showInputPanel bool) Bubble {
styles := DefaultStyles()
model := help.New()
model.Styles.ShortKey = styles.helpKeyStyle.Foreground(jqtheme.Primary)
Expand All @@ -29,7 +29,7 @@ func New(jqtheme theme.Theme) Bubble {
Styles: styles,
help: model,
keys: keys,
showInputPanel: true, // Default to showing input panel
showInputPanel: showInputPanel,
}
}

Expand Down
6 changes: 3 additions & 3 deletions tui/bubbles/jqplayground/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type Bubble struct {
showInputPanel bool
}

func New(inputJSON []byte, filename string, query string, jqtheme theme.Theme) (Bubble, error) {
func New(inputJSON []byte, filename string, query string, jqtheme theme.Theme, showInputPanel bool) (Bubble, error) {
workingDirectory, err := os.Getwd()
if err != nil {
return Bubble{}, err
Expand All @@ -64,11 +64,11 @@ func New(inputJSON []byte, filename string, query string, jqtheme theme.Theme) (
queryinput: queryInput,
inputdata: inputData,
output: output.New(jqtheme),
help: help.New(jqtheme),
help: help.New(jqtheme, showInputPanel),
statusbar: sb,
fileselector: fs,
theme: jqtheme,
showInputPanel: true,
showInputPanel: showInputPanel,
}
return b, nil
}
Loading