AutoYADM commit: 2025-07-07 14:03:25
This commit is contained in:
parent
a08f423e91
commit
459456cd48
2 changed files with 10 additions and 1 deletions
|
@ -12,6 +12,7 @@ while getopts "f:" opt; do
|
|||
echo "accepts file over stdin or as argument"
|
||||
echo "applies <percent><keys> and prints buffer content to stdout"
|
||||
echo "kakrc is not loaded"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option"
|
||||
exit 1
|
||||
|
@ -26,8 +27,11 @@ if [ -z "$filter" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
# create temp files
|
||||
tempdir="$(mktemp -d kakpipe-XXXXXX)"
|
||||
fifo="${tempdir}/fifo"
|
||||
# prioritize arg if it exists
|
||||
# use stdin otherwise
|
||||
if [ -z "$1" ]; then
|
||||
input="$(mktemp -p ${tempdir} input.XXXXXX)"
|
||||
cat >"$input"
|
||||
|
@ -35,7 +39,11 @@ else
|
|||
input="$1"
|
||||
fi
|
||||
|
||||
kak -n -e "exec <percent>; execute-keys \"$filter\"; execute-keys <esc>; write $fifo; quit!" "$input"
|
||||
# run kak as a filter
|
||||
# write buffer to fifo before quitting
|
||||
# cmd="$(printf 'exec <percent>; execute-keys "%s"')"
|
||||
kak -n -e "exec <percent>; execute-keys %{ $filter } ; execute-keys <esc>; write $fifo; quit!" "$input"
|
||||
# print kak output to stdout
|
||||
cat "$fifo"
|
||||
# cleanup
|
||||
rm -r "$tempdir"
|
||||
|
|
1
.config/kak/scripts/kakpipe-11nWu0/input.eXucbL
Normal file
1
.config/kak/scripts/kakpipe-11nWu0/input.eXucbL
Normal file
|
@ -0,0 +1 @@
|
|||
hello
|
Loading…
Add table
Add a link
Reference in a new issue