Improve completions workflow
All checks were successful
/ build-artifacts (autoinstall) (push) Successful in 21s
/ build-artifacts (autostart-manage) (push) Successful in 15s
/ upload-release (push) Successful in 17s

This commit is contained in:
Tobias Reisinger 2024-01-12 02:28:44 +01:00
parent 031bb45eeb
commit 6c2eeb4c9b
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
3 changed files with 15 additions and 6 deletions

View file

@ -14,13 +14,9 @@ generate: get-target output-dir
generate-upgrade: get-target output-dir
BASHLY_SOURCE_DIR=$(TARGET) bashly generate --upgrade
completions: generate-upgrade
BASHLY_SOURCE_DIR=$(TARGET) bashly add --force completions_script ./output/_$(TARGET)
docs: generate
BASHLY_SOURCE_DIR=$(TARGET) bashly render :mandoc ./output/man1
deploy: completions docs
deploy: generate docs
cp -f ./output/$(TARGET) ~/.local/bin/
cp -f ./output/_$(TARGET) ~/.config/completionsrc.d/
cp -f ./output/man1/$(TARGET)*.1 ~/.local/share/man/man1/

View file

@ -1,6 +1,6 @@
name: autoinstall
help: Install files, repository and else
version: 0.1.0
version: 0.1.1
flags:
- long: --clean
@ -73,6 +73,10 @@ commands:
help: Pipe file through command (e.g. "tar xzO")
arg: pipe
default: cat
- long: --completions
short: -c
help: Run a command on the new exe to install completions
arg: completions
- name: archive
help: Install an archive

View file

@ -3,6 +3,7 @@
pipe=${args[--pipe]:?}
target=${args[target]:?}
url=${args[url]:?}
completions=${args[completions]:-}
if [ "${action:-file}" = "exe" ]
then
@ -10,6 +11,7 @@ then
then
return
fi
exe=$target
target="$HOME/.local/bin/$target"
fi
@ -27,6 +29,13 @@ then
if [ "${action:-file}" = "exe" ]
then
chmod +x "$target"
if [ -z "$completions" ]
then
echo "Installing completions for $exe"
# shellcheck disable=SC2086
"$target" $completions > "$XDG_CONFIG_HOME/completionsrc.d/_$(basename "$exe")"
fi
fi
_run_hook