demos: make run_command wait for the prompt

Most commands are non-interactive, so this reduces duplication. We can
add another function for running a command and not waiting for a
prompt when we need it.
This commit is contained in:
Martin von Zweigbergk 2021-10-22 14:17:37 -07:00
parent 234cb15ff8
commit b1d473eafb
2 changed files with 1 additions and 9 deletions

View File

@ -6,20 +6,12 @@ parse_args "$@"
new_tmp_dir
run_demo '
expect_prompt
run_command "# Clone a Git repo:"
expect_prompt
run_command "jj git clone https://github.com/octocat/Hello-World"
expect_prompt
run_command "cd Hello-World"
expect_prompt
run_command "# Inspect it:"
expect_prompt
run_command "jj log"
expect_prompt
run_command "jj diff -r b1"
expect_prompt
run_command "# The repo is backed by the actual Git repo:"
expect_prompt
run_command "git --git-dir=.jj/store/git log --graph --all --decorate --oneline"
'

View File

@ -8,7 +8,7 @@ proc expect_prompt {} {
proc run_command {cmd} {
send -h "$cmd"
send "\r"
expect -timeout 1
expect -timeout 5 "$ "
}
proc quit_and_dump_asciicast_path {} {