Skip to content

Commit 5eaaff4

Browse files
committed
Add zsh and bash completions for x
1 parent ef934d9 commit 5eaaff4

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

src/etc/completions/x.bash

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
3+
_x_completions()
4+
{
5+
if [ "${#COMP_WORDS[@]}" -le "2" ]; then
6+
COMPREPLY=($(compgen -W "build check clippy fix fmt test bench doc clean dist install run setup" "${COMP_WORDS[1]}"))
7+
return
8+
else
9+
compopt -o nospace
10+
local cur=${COMP_WORDS[COMP_CWORD]}
11+
local top=$(git rev-parse --show-toplevel 2>/dev/null || return)
12+
COMPREPLY=$(cd $top && compgen -f -- "$cur")
13+
fi
14+
}
15+
complete -F _x_completions x

src/etc/completions/x.zsh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/env zsh
2+
3+
_x_completions()
4+
{
5+
local line
6+
local top=$(git rev-parse --show-toplevel 2>/dev/null || return)
7+
cd "${top}"
8+
_arguments -C \
9+
"1:subcommand:(build check clippy fix fmt test bench doc clean dist install run setup)" \
10+
"*:files:_files"
11+
cd "${OLDPWD}"
12+
}
13+
compdef _x_completions x

0 commit comments

Comments
 (0)