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
10 changes: 6 additions & 4 deletions shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@ const (

// Shell is a type that contains a prompt and the command to set up the shell.
type Shell struct {
Command []string
Env []string
Command []string
Env []string
OverwriteEnv []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"},
Env: []string{"PS1=\\[\\e[38;2;90;86;224m\\]> \\[\\e[0m\\]", "BASH_SILENCE_DEPRECATION_WARNING=1"},
Command: []string{"bash", "--noprofile", "--norc", "--login", "+o", "history"},
OverwriteEnv: []string{"PROMPT_COMMAND="},
},
zsh: {
Env: []string{`PROMPT=%F{#5B56E0}> %F{reset_color}`},
Expand Down
2 changes: 1 addition & 1 deletion tty.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func buildTtyCmd(port int, shell Shell) *exec.Cmd {

cmd := exec.Command("ttyd", args...)
if shell.Env != nil {
cmd.Env = append(shell.Env, os.Environ()...)
cmd.Env = append(append(shell.Env, os.Environ()...), shell.OverwriteEnv...)
}
return cmd
}