Skip to content

Commit 7cb57d1

Browse files
committed
fix: clear screen after setting shell
1 parent 609f95a commit 7cb57d1

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

examples/demo.gif

Lines changed: 2 additions & 2 deletions
Loading

examples/demo.tape

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ Output examples/demo.gif
5050

5151
Require echo
5252

53+
Set Shell "bash"
5354
Set FontSize 32
5455
Set Width 1200
5556
Set Height 600

examples/welcome.gif

Lines changed: 2 additions & 2 deletions
Loading

shell.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,39 @@ const (
1414
type Shell struct {
1515
Prompt string
1616
Command string
17+
Clear string
1718
}
1819

1920
// Shells contains a mapping from shell names to their Shell struct.
2021
var Shells = map[string]Shell{
2122
bash: {
2223
Prompt: "\\[\\e[38;2;90;86;224m\\]> \\[\\e[0m\\]",
2324
Command: ` PS1="%s" bash --login --norc --noprofile +o history; clear;`,
25+
Clear: "clear",
2426
},
2527
zsh: {
2628
Prompt: `%F{#5B56E0}> %F{reset_color}`,
2729
Command: ` PROMPT="%s" zsh --login --histnostore --no-rcs; clear;`,
30+
Clear: "clear",
2831
},
2932
fish: {
3033
Prompt: `function fish_prompt; echo -e "$(set_color 5B56E0)> $(set_color normal)"; end`,
3134
Command: ` fish --login --no-config --private -C 'function fish_greeting; end' -C '%s'; clear;`,
35+
Clear: "clear",
3236
},
3337
powershell: {
3438
Prompt: `Set-PSReadLineOption -HistorySaveStyle SaveNothing; Function prompt { Write-Host -ForegroundColor Blue -NoNewLine '>'; return ' ' }`,
3539
Command: ` clear; powershell -Login -NoLogo -NoExit -NoProfile -Command %q`,
40+
Clear: "clear",
3641
},
3742
pwsh: {
3843
Prompt: `Set-PSReadLineOption -HistorySaveStyle SaveNothing; Function prompt { Write-Host -ForegroundColor Blue -NoNewLine '>'; return ' ' }`,
3944
Command: ` clear; pwsh -Login -NoLogo -NoExit -NoProfile -Command %q`,
45+
Clear: "clear",
4046
},
4147
cmdexe: {
4248
Prompt: "$g",
4349
Command: ` cls && set prompt=%s && cls`,
50+
Clear: "cls",
4451
},
4552
}

vhs.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ func (vhs *VHS) Setup() {
133133
MustInput(shellCommand).
134134
MustType(input.Enter)
135135

136+
vhs.Page.MustElement("textarea").
137+
MustInput(vhs.Options.Shell.Clear).
138+
MustType(input.Enter)
139+
136140
// Apply options to the terminal
137141
// By this point the setting commands have been executed, so the `opts` struct is up to date.
138142
vhs.Page.MustEval(fmt.Sprintf("() => { term.options = { fontSize: %d, fontFamily: '%s', letterSpacing: %f, lineHeight: %f, theme: %s } }",

0 commit comments

Comments
 (0)