Skip to content

Commit

Permalink
bash completion
Browse files Browse the repository at this point in the history
  • Loading branch information
sulincix committed Jun 8, 2024
1 parent 4309441 commit f3b97bb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions data/bash-completion.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
function _ymp_help() {
local cur prev opts
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
if [[ "$prev" == ymp ]] ; then
opts=$(command ymp help --no-color --allow-oem | cut -f1 -d" " | grep -v "Operation")
elif [[ "$prev" == install ]] ; then
opts=$(ymp list --no-color --allow-oem | tr -s " " | cut -f2 -d" ")
elif [[ "$prev" == remove ]] ; then
opts=$(ymp list --installed --no-color --allow-oem | tr -s " " | cut -f2 -d" ")
fi
opts=+$(ymp $prev --help --no-color |& grep -- "--[a-z]" | cut -f1 -d: | sed "s/ *//g")
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
}
complete -F _ymp_help ymp

1 change: 1 addition & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ install_data('data/fix-turkish.sed', install_dir : get_option('prefix') / 'share
install_data('data/ymp-mime.xml', install_dir : get_option('prefix') / 'share/mime/packages/')
install_data('data/debian-names.yaml', install_dir : get_option('sysconfdir'))
install_data(meson.current_build_dir() / 'obj.o', install_dir : get_option('libdir'), rename : 'empty.o')
install_data('data/bash-completion.sh', install_dir : get_option('prefix')/ 'bash-completion/completions/', rename: 'ymp')

########### install headers ###########
install_data(meson.current_build_dir() / 'ymp.h', install_dir : get_option('includedir')/'ymp/')
Expand Down

0 comments on commit f3b97bb

Please sign in to comment.