From 9f5343cc5d8cadc92365c221c662d5b3e36d1351 Mon Sep 17 00:00:00 2001 From: Ilya Grigoriev Date: Mon, 28 Aug 2023 20:57:26 -0700 Subject: [PATCH] demos: fix terminal width for screenshots --- demos/helpers.sh | 5 ++++- demos/run_scripts.sh | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/demos/helpers.sh b/demos/helpers.sh index 6c611d71ef..cdc2ceeb5e 100644 --- a/demos/helpers.sh +++ b/demos/helpers.sh @@ -11,7 +11,9 @@ new_tmp_dir() { run_command() { echo "\$ $@" - eval "$@" + # `bash` often resets $COLUMNS, so we also + # allow $RUN_COMMAND_COLUMNS + COLUMNS=${RUN_COMMAND_COLUMNS-${COLUMNS-80}} eval "$@" } run_command_allow_broken_pipe() { @@ -60,5 +62,6 @@ username = "jjfan" [ui] color="always" paginate="never" +log-word-wrap=true # Need to set COLUMNS for this to work EOF } diff --git a/demos/run_scripts.sh b/demos/run_scripts.sh index 5dcb194cd2..26e257c547 100755 --- a/demos/run_scripts.sh +++ b/demos/run_scripts.sh @@ -32,6 +32,15 @@ GIT_CONFIG_GLOBAL=$(mktemp --tmpdir gitconfig-XXXX) export GIT_CONFIG_GLOBAL git_config "$GIT_CONFIG_GLOBAL" +# Make `jj` wrap text as opposed to `term-transcript` Currently, 80 is the only +# value that tool supports when used as a CLI. +# https://github.com/slowli/term-transcript/issues/59 +# +# Note that `bash` likes to reset the value of $COLUMNS, so we need to use a +# different variable here. +RUN_COMMAND_COLUMNS=80 +export RUN_COMMAND_COLUMNS + run_script_through_term_transcript_and_pipe_result_to_stderr() { script="$1" script_base="${script%.sh}"