forked from charmbracelet/vhs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
shell.go
67 lines (64 loc) · 1.65 KB
/
shell.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package main
// Supported shells of VHS
const (
bash = "bash"
cmdexe = "cmd"
fish = "fish"
nushell = "nu"
powershell = "powershell"
pwsh = "pwsh"
zsh = "zsh"
)
// Shell is a type that contains a prompt and the command to set up the shell.
type Shell struct {
Command []string
Env []string
}
// Shells contains a mapping from shell names to their Shell struct.
var Shells = map[string]Shell{
bash: {
Env: []string{"PS1=\\[\\e[38;2;90;86;224m\\]> \\[\\e[0m\\]", "BASH_SILENCE_DEPRECATION_WARNING=1"},
Command: []string{"bash", "--noprofile", "--norc", "--login", "+o", "history"},
},
zsh: {
Env: []string{`PROMPT=%F{#5B56E0}> %F{reset_color}`},
Command: []string{"zsh", "--histnostore", "--no-rcs"},
},
fish: {
Command: []string{
"fish",
"--login",
"--no-config",
"--private",
"-C", "function fish_greeting; end",
"-C", `function fish_prompt; set_color 5B56E0; echo -n "> "; set_color normal; end`,
},
},
powershell: {
Command: []string{
"powershell",
"-NoLogo",
"-NoExit",
"-NoProfile",
"-Command",
`Set-PSReadLineOption -HistorySaveStyle SaveNothing; function prompt { Write-Host '>' -NoNewLine -ForegroundColor Blue; return ' ' }`,
},
},
pwsh: {
Command: []string{
"pwsh",
"-Login",
"-NoLogo",
"-NoExit",
"-NoProfile",
"-Command",
`Set-PSReadLineOption -HistorySaveStyle SaveNothing; Function prompt { Write-Host -ForegroundColor Blue -NoNewLine '>'; return ' ' }`,
},
},
cmdexe: {
Command: []string{"cmd.exe", "/k", "prompt=^> "},
},
nushell: {
Command: []string{"nu", "--interactive", "--execute", "let-env PROMPT_COMMAND = { '' }"},
},
}