| 1 |
# health-check tab completion for bash. |
| 2 |
# |
| 3 |
# Copyright (C) 2020-2021 Canonical |
| 4 |
# |
| 5 |
# This program is free software; you can redistribute it and/or |
| 6 |
# modify it under the terms of the GNU General Public License |
| 7 |
# as published by the Free Software Foundation; either version 2 |
| 8 |
# of the License, or (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 18 |
|
| 19 |
_health-check() |
| 20 |
{ |
| 21 |
local cur prev |
| 22 |
_init_completion || return |
| 23 |
|
| 24 |
case "$prev" in |
| 25 |
'-d') COMPREPLY=( $(compgen -W "duration" -- $cur) ) |
| 26 |
return 0 |
| 27 |
;; |
| 28 |
'-p') COMPREPLY=( $(compgen -W '$(command ps axo pid | sed 1d) ' $cur ) ) |
| 29 |
return 0 |
| 30 |
;; |
| 31 |
'-m') COMPREPLY=( $(compgen -W "maxcalls" -- $cur) ) |
| 32 |
return 0 |
| 33 |
;; |
| 34 |
'-o') _filedir |
| 35 |
return 0 |
| 36 |
;; |
| 37 |
'-u') COMPREPLY=( $(compgen -W '$(command ps axo user | sed 1d | sort | uniq) ' $cur ) ) |
| 38 |
return 0 |
| 39 |
;; |
| 40 |
esac |
| 41 |
|
| 42 |
case "$cur" in |
| 43 |
-*) |
| 44 |
OPTS="-b -c -d -f -h -p -m -o -r -u -v -w -W" |
| 45 |
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) ) |
| 46 |
return 0 |
| 47 |
;; |
| 48 |
esac |
| 49 |
return 0 |
| 50 |
} |
| 51 |
|
| 52 |
# load the completion |
| 53 |
complete -F _health-check health-check |