From 3db3445822f7c0f04bcc5f4b657b85b77fc48bdc Mon Sep 17 00:00:00 2001 From: Gokcehan Date: Mon, 9 Nov 2020 01:49:13 +0300 Subject: [PATCH] add bash completion script --- etc/lf.bash | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 etc/lf.bash diff --git a/etc/lf.bash b/etc/lf.bash new file mode 100644 index 0000000..7daeb86 --- /dev/null +++ b/etc/lf.bash @@ -0,0 +1,29 @@ +# Autocompletion for bash shell. +# +# You may put this file to a directory used by bash-completion: +# +# mkdir -p ~/.local/share/bash-completion/completions +# ln -s "/path/to/lf.bash" ~/.local/share/bash-completion/completions +# + +_lf () { + local -a opts=( + -command + -cpuprofile + -doc + -last-dir-path + -memprofile + -remote + -selection-path + -server + -version + -help + ) + if [[ $2 == -* ]]; then + COMPREPLY=( $(compgen -W "${opts[*]}" -- "$2") ) + else + COMPREPLY=( $(compgen -f -d -- "$2") ) + fi +} + +complete -o filenames -F _lf lf lfcd