Documentation
¶
Index ¶
- Constants
- func FunctionDescription(name string) string
- func FunctionTemplate(name string) (args string, cursorBack int, placeholderLen int)
- func ParseKey(s string) (termbox.Key, bool)
- type BehaviorConfig
- type Config
- type Engine
- type EngineAttribute
- type EngineInterface
- type EngineResult
- type EngineResultInterface
- type History
- type HistoryConfig
- type JsonManager
- func (jm *JsonManager) Get(q QueryInterface, confirm bool) (string, []string, []string, error)
- func (jm *JsonManager) GetCandidateKeys(q QueryInterface) []string
- func (jm *JsonManager) GetFilteredData(q QueryInterface, confirm bool) (*simplejson.Json, []string, []string, error)
- func (jm *JsonManager) GetPretty(q QueryInterface, confirm bool) (string, []string, []string, error)
- type KeybindingsConfig
- type Query
- func (q *Query) Add(query []rune) []rune
- func (q *Query) Clear() []rune
- func (q *Query) Delete(i int) []rune
- func (q *Query) Get() []rune
- func (q *Query) GetChar(idx int) rune
- func (q *Query) GetKeywords() [][]rune
- func (q *Query) GetLastKeyword() []rune
- func (q *Query) IndexOffset(i int) int
- func (q *Query) Insert(query []rune, idx int) []rune
- func (q *Query) Length() int
- func (q *Query) PopKeyword() ([]rune, []rune)
- func (q *Query) Set(query []rune) []rune
- func (q *Query) StringAdd(query string) string
- func (q *Query) StringGet() string
- func (q *Query) StringGetKeywords() []string
- func (q *Query) StringGetLastKeyword() string
- func (q *Query) StringInsert(query string, idx int) string
- func (q *Query) StringPopKeyword() (string, []rune)
- func (q *Query) StringSet(query string) string
- type QueryInterface
- type Suggestion
- func (s *Suggestion) Get(json *simplejson.Json, keyword string) []string
- func (s *Suggestion) GetCandidateKeys(json *simplejson.Json, keyword string) []string
- func (s *Suggestion) GetCurrentType(json *simplejson.Json) SuggestionDataType
- func (s *Suggestion) GetFunctionCandidates(prefix string) []string
- func (s *Suggestion) GetFunctionCandidatesFiltered(prefix string, t SuggestionDataType) []string
- func (s *Suggestion) GetFunctionSuggestion(prefix string) []string
- func (s *Suggestion) GetFunctionSuggestionFiltered(prefix string, t SuggestionDataType) []string
- type SuggestionDataType
- type SuggestionInterface
- type Terminal
- type TerminalDrawAttributes
Constants ¶
const ( DefaultY int = 1 FilterPrompt string = "[Filter]> " )
Variables ¶
This section is empty.
Functions ¶
func FunctionDescription ¶ added in v1.0.0
FunctionDescription returns the usage description for a JMESPath function name. name may include a trailing "(". Returns "" if not found.
func FunctionTemplate ¶ added in v1.0.0
FunctionTemplate returns the argument template, cursor-back offset, and placeholder length for a JMESPath function. name may include a trailing "(".
Types ¶
type BehaviorConfig ¶ added in v1.1.1
type BehaviorConfig struct {
// ExitOnEnter controls whether Enter exits jid (default: true for backwards compatibility).
// Set to false to make Enter only confirm a candidate; use the quit keybinding to exit.
ExitOnEnter *bool `toml:"exit_on_enter"`
}
BehaviorConfig controls general jid behaviour.
type Config ¶ added in v1.1.0
type Config struct {
History HistoryConfig `toml:"history"`
Keybindings KeybindingsConfig `toml:"keybindings"`
Behavior BehaviorConfig `toml:"behavior"`
}
Config holds all jid configuration.
func LoadConfig ¶ added in v1.1.0
func LoadConfig() Config
LoadConfig reads ~/.config/jid/config.toml (or OS equivalent). Missing fields fall back to defaults; missing file returns defaults silently.
func (*Config) HistoryPath ¶ added in v1.1.0
HistoryPath returns the resolved history file path. Uses the configured path if set, otherwise falls back to the OS default.
func (*Config) IsExitOnEnter ¶ added in v1.1.1
IsExitOnEnter returns true when Enter should exit jid (the default).
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) GetQuery ¶
func (e *Engine) GetQuery() QueryInterface
func (*Engine) Run ¶
func (e *Engine) Run() EngineResultInterface
type EngineAttribute ¶
type EngineInterface ¶
type EngineInterface interface {
Run() EngineResultInterface
GetQuery() QueryInterface
}
func NewEngine ¶
func NewEngine(s io.Reader, ea *EngineAttribute) (EngineInterface, error)
type EngineResult ¶
type EngineResult struct {
// contains filtered or unexported fields
}
func (*EngineResult) GetContent ¶
func (er *EngineResult) GetContent() string
func (*EngineResult) GetError ¶
func (er *EngineResult) GetError() error
func (*EngineResult) GetQueryString ¶
func (er *EngineResult) GetQueryString() string
type EngineResultInterface ¶
type History ¶ added in v1.1.0
type History struct {
// contains filtered or unexported fields
}
func NewHistory ¶ added in v1.1.0
func (*History) Add ¶ added in v1.1.0
Add adds a query to history with deduplication (moves existing entry to end).
func (*History) AtEnd ¶ added in v1.1.0
AtEnd returns true when the navigation cursor is at the newest position.
func (*History) Next ¶ added in v1.1.0
Next moves to the next (newer) entry and returns it. Returns "", false when moving past the newest entry (back to current input).
type HistoryConfig ¶ added in v1.1.0
HistoryConfig controls query history behaviour.
type JsonManager ¶
type JsonManager struct {
// contains filtered or unexported fields
}
func NewJsonManager ¶
func NewJsonManager(reader io.Reader) (*JsonManager, error)
func (*JsonManager) Get ¶
func (jm *JsonManager) Get(q QueryInterface, confirm bool) (string, []string, []string, error)
func (*JsonManager) GetCandidateKeys ¶
func (jm *JsonManager) GetCandidateKeys(q QueryInterface) []string
func (*JsonManager) GetFilteredData ¶
func (jm *JsonManager) GetFilteredData(q QueryInterface, confirm bool) (*simplejson.Json, []string, []string, error)
func (*JsonManager) GetPretty ¶
func (jm *JsonManager) GetPretty(q QueryInterface, confirm bool) (string, []string, []string, error)
type KeybindingsConfig ¶ added in v1.1.0
type KeybindingsConfig struct {
HistoryPrev string `toml:"history_prev"`
HistoryNext string `toml:"history_next"`
CandidateNext string `toml:"candidate_next"` // cycle forward (default: tab)
CandidatePrev string `toml:"candidate_prev"` // cycle backward (additional key; Shift+Tab always works)
ScrollDown string `toml:"scroll_down"`
ScrollUp string `toml:"scroll_up"`
ScrollToBottom string `toml:"scroll_to_bottom"`
ScrollToTop string `toml:"scroll_to_top"`
ScrollPageDown string `toml:"scroll_page_down"`
ScrollPageUp string `toml:"scroll_page_up"`
ToggleKeymode string `toml:"toggle_keymode"`
DeleteLine string `toml:"delete_line"`
DeleteWord string `toml:"delete_word"`
CursorLeft string `toml:"cursor_left"`
CursorRight string `toml:"cursor_right"`
CursorToStart string `toml:"cursor_to_start"`
CursorToEnd string `toml:"cursor_to_end"`
ToggleFuncHelp string `toml:"toggle_func_help"`
Quit string `toml:"quit"`
}
KeybindingsConfig maps action names to key strings (e.g. "ctrl+j", "up").
type Query ¶
type Query struct {
// contains filtered or unexported fields
}
func NewQueryWithString ¶
func (*Query) GetKeywords ¶
func (*Query) GetLastKeyword ¶
func (*Query) IndexOffset ¶
func (*Query) PopKeyword ¶
func (*Query) StringGetKeywords ¶
func (*Query) StringGetLastKeyword ¶
func (*Query) StringPopKeyword ¶
type QueryInterface ¶
type QueryInterface interface {
Get() []rune
Set(query []rune) []rune
Insert(query []rune, idx int) []rune
Add(query []rune) []rune
Delete(i int) []rune
Clear() []rune
Length() int
IndexOffset(int) int
GetChar(int) rune
GetKeywords() [][]rune
GetLastKeyword() []rune
PopKeyword() ([]rune, []rune)
StringGet() string
StringSet(query string) string
StringInsert(query string, idx int) string
StringAdd(query string) string
StringGetKeywords() []string
StringGetLastKeyword() string
StringPopKeyword() (string, []rune)
}
type Suggestion ¶
type Suggestion struct {
}
func NewSuggestion ¶
func NewSuggestion() *Suggestion
func (*Suggestion) Get ¶
func (s *Suggestion) Get(json *simplejson.Json, keyword string) []string
func (*Suggestion) GetCandidateKeys ¶
func (s *Suggestion) GetCandidateKeys(json *simplejson.Json, keyword string) []string
func (*Suggestion) GetCurrentType ¶
func (s *Suggestion) GetCurrentType(json *simplejson.Json) SuggestionDataType
func (*Suggestion) GetFunctionCandidates ¶ added in v1.0.0
func (s *Suggestion) GetFunctionCandidates(prefix string) []string
GetFunctionCandidates returns JMESPath function names (with trailing "(") that match the given prefix (case-insensitive).
func (*Suggestion) GetFunctionCandidatesFiltered ¶ added in v1.0.0
func (s *Suggestion) GetFunctionCandidatesFiltered(prefix string, t SuggestionDataType) []string
GetFunctionCandidatesFiltered returns function candidates filtered by the given data type. UNKNOWN means all functions are shown.
func (*Suggestion) GetFunctionSuggestion ¶ added in v1.0.0
func (s *Suggestion) GetFunctionSuggestion(prefix string) []string
GetFunctionSuggestion returns [completion, suggestion] for function-name autocompletion, mirroring the return format of Get().
func (*Suggestion) GetFunctionSuggestionFiltered ¶ added in v1.0.0
func (s *Suggestion) GetFunctionSuggestionFiltered(prefix string, t SuggestionDataType) []string
GetFunctionSuggestionFiltered returns [completion, suggestion] filtered by the given data type.
type SuggestionDataType ¶
type SuggestionDataType int
const ( UNKNOWN SuggestionDataType = iota ARRAY MAP NUMBER STRING BOOL )
type SuggestionInterface ¶
type Terminal ¶
type Terminal struct {
// contains filtered or unexported fields
}
func (*Terminal) Draw ¶
func (t *Terminal) Draw(attr *TerminalDrawAttributes) error
type TerminalDrawAttributes ¶
type TerminalDrawAttributes struct {
Query string
Contents []string
CandidateIndex int
ContentsOffsetY int
Complete string
Candidates []string
CursorOffset int
FuncHelp string
PlaceholderStart int // rune index in Query; -1 if no placeholder
PlaceholderLen int
SelectedCandidate string // field name to highlight in JSON; "" if none
SelectedCandidateIndent int // indentation level of the target key
}