diff options
author | isaackwy <isaacyu@protonmail.com> | 2024-06-11 23:19:09 -0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2024-06-15 07:37:45 +0700 |
commit | 5956790ea5e56b9be6bb7535c272a2e993cfb67d (patch) | |
tree | 79a5e39400e2b9dfb3484784e8d74ab703515ff7 /system/trash-cli/trash-cli.SlackBuild | |
parent | 30e060376c3347275b479fae7f8f97f738628b22 (diff) |
system/trash-cli: Add shell completions
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/trash-cli/trash-cli.SlackBuild')
-rw-r--r-- | system/trash-cli/trash-cli.SlackBuild | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/system/trash-cli/trash-cli.SlackBuild b/system/trash-cli/trash-cli.SlackBuild index a98fa2482e9af..3f483b4c46783 100644 --- a/system/trash-cli/trash-cli.SlackBuild +++ b/system/trash-cli/trash-cli.SlackBuild @@ -70,6 +70,17 @@ sed 's|share/man/|man/|' -i setup.cfg python3 setup.py install --root=$PKG +# Add trash-cli shell completions (requires python3-shtab) +# Reference: https://github.com/zsh-users/zsh-completions/pull/895 +if $(python3 -c 'import pkgutil; exit(not pkgutil.find_loader("shtab"))'); then + mkdir -p $PKG/usr/share/bash-completion/completions + mkdir -p $PKG/usr/share/zsh/site-functions + for CMD in trash-empty trash-list trash-restore trash-put trash; do + $CMD --print-completion bash > "$PKG/usr/share/bash-completion/completions/$CMD" + $CMD --print-completion zsh > "$PKG/usr/share/zsh/site-functions/_$CMD" + done +fi + find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true |