Documentation
¶
Index ¶
- func CleanChildEnv(envList []string, fd int, pid int) []string
- func GetFishConfigDir() string
- func GetFishDataDir() string
- func GetZshConfigDir() string
- func Init(name string)
- func ParseAliases(data string) map[string]string
- func ParseFishConfig(dir, data string) (map[string]string, map[string]string)
- func ReplaceLine(text []byte, cursorFromEnd int) []byte
- func ScanPosixAliases(files []string) map[string]string
- func SplitAliasTokens(s string) []string
- type AbbrScanner
- type Adapter
- type BashAdapter
- type FishAdapter
- func (f *FishAdapter) GetEnv(fd int, pid int) []string
- func (f *FishAdapter) GetName() string
- func (f *FishAdapter) GetShellPath() string
- func (f *FishAdapter) PrepareSelectSequence(selected string, cursorFromEnd int) []byte
- func (f *FishAdapter) ScanAbbrs() map[string]string
- func (f *FishAdapter) ScanAliases() map[string]string
- type ZshAdapter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanChildEnv ¶ added in v0.7.2
clean child environment to avoid duplicate multishell entries and deduplicate path
func GetFishConfigDir ¶ added in v0.4.4
func GetFishConfigDir() string
func GetFishDataDir ¶ added in v0.4.15
func GetFishDataDir() string
func GetZshConfigDir ¶ added in v0.4.4
func GetZshConfigDir() string
func ParseAliases ¶
func ParseFishConfig ¶ added in v0.7.0
func ReplaceLine ¶ added in v0.7.0
ReplaceLine builds the byte sequence that clears the shell's current input line and types text in its place. cursorFromEnd is how many characters the cursor sits to the left of the end of the line.
ctrl+u only clears the whole line from the end: it is kill-whole-line in zsh's stock emacs keymap, but kills backwards under bash (unix-line-discard), fish, zsh's vi keymap, and `bindkey '^U' backward-kill-line`. Left mid-line, everything to the right of the cursor survived and collided with the text typed next.
The cursor therefore has to reach the end first, and it walks there with the right arrow rather than ctrl+e. ctrl+e is a key people rebind -- binding it to atuin-search is common, and iris sending it opened the atuin overlay every time it rewrote the line.
func ScanPosixAliases ¶
func SplitAliasTokens ¶
Types ¶
type AbbrScanner ¶ added in v0.7.0
type Adapter ¶
type Adapter interface {
GetName() string
GetShellPath() string
GetEnv(fd int, pid int) []string
PrepareSelectSequence(selected string, cursorFromEnd int) []byte
// ScanAliases returns a map of alias name to target command
ScanAliases() map[string]string
}
Adapter defines the behavior for different shell environments
var Current Adapter
Current shell instance
type BashAdapter ¶
type BashAdapter struct{}
BashAdapter implementation
func (*BashAdapter) GetName ¶
func (b *BashAdapter) GetName() string
func (*BashAdapter) GetShellPath ¶
func (b *BashAdapter) GetShellPath() string
func (*BashAdapter) PrepareSelectSequence ¶
func (b *BashAdapter) PrepareSelectSequence(selected string, cursorFromEnd int) []byte
func (*BashAdapter) ScanAliases ¶
func (b *BashAdapter) ScanAliases() map[string]string
type FishAdapter ¶
type FishAdapter struct{}
FishAdapter implementation
func (*FishAdapter) GetName ¶
func (f *FishAdapter) GetName() string
func (*FishAdapter) GetShellPath ¶
func (f *FishAdapter) GetShellPath() string
func (*FishAdapter) PrepareSelectSequence ¶
func (f *FishAdapter) PrepareSelectSequence(selected string, cursorFromEnd int) []byte
func (*FishAdapter) ScanAbbrs ¶ added in v0.7.0
func (f *FishAdapter) ScanAbbrs() map[string]string
func (*FishAdapter) ScanAliases ¶
func (f *FishAdapter) ScanAliases() map[string]string
type ZshAdapter ¶
type ZshAdapter struct{}
ZshAdapter implementation
func (*ZshAdapter) GetName ¶
func (z *ZshAdapter) GetName() string
func (*ZshAdapter) GetShellPath ¶
func (z *ZshAdapter) GetShellPath() string
func (*ZshAdapter) PrepareSelectSequence ¶
func (z *ZshAdapter) PrepareSelectSequence(selected string, cursorFromEnd int) []byte
func (*ZshAdapter) ScanAliases ¶
func (z *ZshAdapter) ScanAliases() map[string]string