Skip to content

Commit

Permalink
chore: add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesmithgh committed May 29, 2024
1 parent a7513a3 commit 0597f4b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions scripts/edit_command_line.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/sh

if [ -z "$1" ]; then
printf 'missing input file\n'
exit 2
Expand All @@ -8,16 +9,20 @@ fi
# the last argument is used because in the case of zsh, commands maybe be passed before the filename e.g., (-c)
for input_file; do true; done

# after exiting this script and before it has been read by kitty-scrollback.nvim
# the contents of the original input_file may be altered
# avoid this by copying the input_file to a new file that will be referenced
ksb_input_dir=$(mktemp -d)
ksb_input_file="$ksb_input_dir/input.ksb_editcommand"

cp "$input_file" "$ksb_input_file"

# printf 'input file is %s\n' "$ksb_input_file"

kitty @ kitten /Users/mike/gitrepos/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py \
--env "KITTY_SCROLLBACK_NVIM_EDIT_INPUT=$ksb_input_file"

sleep 0.5 # small delay to avoid adding extra prompt TODO: look into this
# small delay before to avoid adding an extra prompt after
# this command has exited and before kitty-scrollback.nvim
# has had time to get the scrollback buffer from kitty
sleep 1

# exit non-zero so that the command is not executed in bash
exit 1

0 comments on commit 0597f4b

Please sign in to comment.