From ce84e289b2ef430a6988c649203ee6ee11fac9e2 Mon Sep 17 00:00:00 2001 From: Joe LeVeque Date: Wed, 1 Mar 2017 14:34:57 -0800 Subject: [PATCH] [sonic_cli]: Fix bash completion for 'show' command (#12) [sonic_cli]: Fix bash completion for 'show' command --- data/etc/bash_completion.d/show | 8 ++++++++ setup.py | 3 +++ stdeb.cfg | 2 +- 3 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 data/etc/bash_completion.d/show diff --git a/data/etc/bash_completion.d/show b/data/etc/bash_completion.d/show new file mode 100644 index 000000000000..fbab3cd77c5e --- /dev/null +++ b/data/etc/bash_completion.d/show @@ -0,0 +1,8 @@ +_show_completion() { + COMPREPLY=( $( env COMP_WORDS="${COMP_WORDS[*]}" \ + COMP_CWORD=$COMP_CWORD \ + _SHOW_COMPLETE=complete $1 ) ) + return 0 +} + +complete -F _show_completion -o default show; diff --git a/setup.py b/setup.py index 5ed14a13d021..844a17bc3ead 100644 --- a/setup.py +++ b/setup.py @@ -22,6 +22,9 @@ 'scripts/portstat', 'scripts/sfputil', ], + data_files=[ + ('/etc/bash_completion.d', ['data/etc/bash_completion.d/show']) + ], entry_points={ 'console_scripts': [ 'show = sonic_cli.main:cli', diff --git a/stdeb.cfg b/stdeb.cfg index ad9dc4b00d14..e74391cb264f 100644 --- a/stdeb.cfg +++ b/stdeb.cfg @@ -1,2 +1,2 @@ [DEFAULT] -Depends: psmisc, grub2-common +Depends: psmisc, grub2-common, bash-completion