Improve completions workflow
This commit is contained in:
parent
031bb45eeb
commit
6c2eeb4c9b
3 changed files with 15 additions and 6 deletions
6
Makefile
6
Makefile
|
@ -14,13 +14,9 @@ generate: get-target output-dir
|
||||||
generate-upgrade: get-target output-dir
|
generate-upgrade: get-target output-dir
|
||||||
BASHLY_SOURCE_DIR=$(TARGET) bashly generate --upgrade
|
BASHLY_SOURCE_DIR=$(TARGET) bashly generate --upgrade
|
||||||
|
|
||||||
completions: generate-upgrade
|
|
||||||
BASHLY_SOURCE_DIR=$(TARGET) bashly add --force completions_script ./output/_$(TARGET)
|
|
||||||
|
|
||||||
docs: generate
|
docs: generate
|
||||||
BASHLY_SOURCE_DIR=$(TARGET) bashly render :mandoc ./output/man1
|
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) ~/.local/bin/
|
||||||
cp -f ./output/_$(TARGET) ~/.config/completionsrc.d/
|
|
||||||
cp -f ./output/man1/$(TARGET)*.1 ~/.local/share/man/man1/
|
cp -f ./output/man1/$(TARGET)*.1 ~/.local/share/man/man1/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: autoinstall
|
name: autoinstall
|
||||||
help: Install files, repository and else
|
help: Install files, repository and else
|
||||||
version: 0.1.0
|
version: 0.1.1
|
||||||
|
|
||||||
flags:
|
flags:
|
||||||
- long: --clean
|
- long: --clean
|
||||||
|
@ -73,6 +73,10 @@ commands:
|
||||||
help: Pipe file through command (e.g. "tar xzO")
|
help: Pipe file through command (e.g. "tar xzO")
|
||||||
arg: pipe
|
arg: pipe
|
||||||
default: cat
|
default: cat
|
||||||
|
- long: --completions
|
||||||
|
short: -c
|
||||||
|
help: Run a command on the new exe to install completions
|
||||||
|
arg: completions
|
||||||
|
|
||||||
- name: archive
|
- name: archive
|
||||||
help: Install an archive
|
help: Install an archive
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
pipe=${args[--pipe]:?}
|
pipe=${args[--pipe]:?}
|
||||||
target=${args[target]:?}
|
target=${args[target]:?}
|
||||||
url=${args[url]:?}
|
url=${args[url]:?}
|
||||||
|
completions=${args[completions]:-}
|
||||||
|
|
||||||
if [ "${action:-file}" = "exe" ]
|
if [ "${action:-file}" = "exe" ]
|
||||||
then
|
then
|
||||||
|
@ -10,6 +11,7 @@ then
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
exe=$target
|
||||||
target="$HOME/.local/bin/$target"
|
target="$HOME/.local/bin/$target"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -27,6 +29,13 @@ then
|
||||||
if [ "${action:-file}" = "exe" ]
|
if [ "${action:-file}" = "exe" ]
|
||||||
then
|
then
|
||||||
chmod +x "$target"
|
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
|
fi
|
||||||
|
|
||||||
_run_hook
|
_run_hook
|
||||||
|
|
Loading…
Reference in a new issue