Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Default = KeyMap{ Up: key.NewBinding( key.WithKeys("up"), key.WithHelp("↑", "history up"), ), Down: key.NewBinding( key.WithKeys("down"), key.WithHelp("↓", "history down"), ), Left: key.NewBinding( key.WithKeys("left"), key.WithHelp("←", "left"), ), Right: key.NewBinding( key.WithKeys("right"), key.WithHelp("→", "right"), ), ExecuteCommand: key.NewBinding( key.WithKeys("enter"), key.WithHelp("enter", "execute command"), ), Cancel: key.NewBinding( key.WithKeys("ctrl+c", "esc"), key.WithHelp("ctrl+c/esc", "cancel"), ), SearchHistoryBackwards: key.NewBinding( key.WithKeys("ctrl+r"), key.WithHelp("ctrl+r", "history search"), ), SearchHistoryForwards: key.NewBinding( key.WithKeys("ctrl+s"), key.WithHelp("ctrl+s", "history search (forward)"), ), AutoComplete: key.NewBinding( key.WithKeys("tab"), key.WithHelp("tab", "autocomplete"), ), PreviousAutoComplete: key.NewBinding( key.WithKeys("shift+tab"), key.WithHelp("shift+tab", "previous autocomplete"), ), Quit: key.NewBinding( key.WithKeys("ctrl+d"), key.WithHelp("ctrl+d", "quit"), ), }
Default is the default keymap for the prompt
Functions ¶
This section is empty.
Types ¶
type KeyMap ¶
type KeyMap struct { Up key.Binding // Up is a binding for the user to look back in their command history Down key.Binding // Down is a binding for the user to look forward in their command history Left key.Binding // Left is a binding for the user to move the cursor left Right key.Binding // Right is a binding for the user to move the cursor right ExecuteCommand key.Binding // ExecuteCommand is a binding for the user to execute the current command // Cancel is a binding for the user to cancel their current command // // It's behaviour changes depending on what the user is doing: // // 1. If a command is being run, it will cancel the command's context // 2. If the user is searching their command history, it will cancel the search // 3. If the user has a partially typed in command, it will clear the input // 4. If none of the above, it will exit the shell Cancel key.Binding SearchHistoryBackwards key.Binding // SearchHistoryBackwards is a binding for the user to search their command history backwards SearchHistoryForwards key.Binding // SearchHistoryForwards is a binding for the user to search their command history forwards AutoComplete key.Binding // AutoComplete is a binding for the user to autocomplete their current command or cycle through autocompletions PreviousAutoComplete key.Binding // PreviousAutoComplete is a binding for the user to cycle through previous autocompletions // Quit is the binding for the user to quit the shell no matter what they are doing Quit key.Binding }
KeyMap is a collection of all the key bindings used by the shell
A Default is provided and will be used by the shell if no other KeyMap is provided when creating a new shell.
Click to show internal directories.
Click to hide internal directories.