Commit 0c6d5c27 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add print our commands to bash completion, to print usage

parent ca4de805
...@@ -5,13 +5,14 @@ ...@@ -5,13 +5,14 @@
# #
_service_list() _service_list()
{ {
COMPREPLY=( $( serv list-all 2>/dev/null ) ) COMPREPLY=( $( serv list-all 2>/dev/null ; echo "list list-all list-startup" ) )
COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) ) COMPREPLY=( $( compgen -W '${COMPREPLY[@]}' -- "$cur" ) )
} }
_service_usage_list() _service_usage_list()
{ {
COMPREPLY=( $( compgen -W '`serv ${prev##*/} 2>/dev/null | sed -e "y/|/ /" -ne "s/^.*\(U\|msg_u\)sage.*{\(.*\)}.*$/\2/p" `' -- "$cur" ) ) local USLIST=$(serv ${prev##*/} usage 2>/dev/null | sed -e "y/|/ /" -ne "s/^.*\(u\|U\|msg_u\)sage.*{\(.*\)}.*$/\2/p")
COMPREPLY=( $( compgen -W '$USLIST' -- "$cur" ) )
} }
......
...@@ -17,6 +17,11 @@ ...@@ -17,6 +17,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
_print_additional_usage()
{
echo "serv addition usage: {on|off|try-restart|usage}"
}
# Print usage of the service # Print usage of the service
serv_usage() serv_usage()
{ {
...@@ -40,4 +45,6 @@ serv_usage() ...@@ -40,4 +45,6 @@ serv_usage()
;; ;;
esac esac
_print_additional_usage
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment