Skip to content

Commit ad85f3d

Browse files
committed
Bash completions
1 parent 956c5b7 commit ad85f3d

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

Vagrantfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Vagrant.configure(2) do |config|
2121
config.vm.provision :shell, privileged: true, inline: <<-EOF
2222
apt-get install -qq -o=Dpkg::Use-Pty=0 -y \
2323
git cmake curl attr pkg-config libgit2-dev \
24-
fish
24+
fish zsh bash bash-completion
2525
EOF
2626

2727

@@ -63,6 +63,9 @@ Vagrant.configure(2) do |config|
6363

6464
# Link the completion files so they’re “installed”.
6565
config.vm.provision :shell, privileged: true, inline: <<-EOF
66+
test -h /etc/bash_completion.d/exa \
67+
|| ln -s /vagrant/contrib/completions.bash /etc/bash_completion.d/exa
68+
6669
test -h /usr/share/zsh/vendor-completions/_exa \
6770
|| ln -s /vagrant/contrib/completions.zsh /usr/share/zsh/vendor-completions/_exa
6871

contrib/completions.bash

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
_exa()
2+
{
3+
cur=${COMP_WORDS[COMP_CWORD]}
4+
prev=${COMP_WORDS[COMP_CWORD-1]}
5+
6+
case "$prev" in
7+
-'?'|--help|-v|--version)
8+
return
9+
;;
10+
11+
-L|--level)
12+
COMPREPLY=( $( compgen -W '{0..9}' -- "$cur" ) )
13+
return
14+
;;
15+
16+
-s|--sort)
17+
COMPREPLY=( $( compgen -W 'name filename Name Filename size filesize extension Extension modified accessed created none inode --' -- "$cur" ) )
18+
return
19+
;;
20+
21+
-t|--time)
22+
COMPREPLY=( $( compgen -W 'accessed modified created --' -- $cur ) )
23+
return
24+
;;
25+
esac
26+
27+
case "$cur" in
28+
-*)
29+
COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
30+
;;
31+
32+
*)
33+
_filedir
34+
;;
35+
esac
36+
} &&
37+
complete -o filenames -o bashdefault -F _exa exa

0 commit comments

Comments
 (0)