/
githubmirror
/
libcap-ng
Обзор
Документация
Войти
/
githubmirror
/
libcap-ng
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
utils/libcap-ng.bash_completion
104 строки
2 KB
Steve Grubb
Audit utility license notices
03 авг 2026, 01:38
03 авг 2026, 01:38
38b19c1
Код
Авторство
О чём код?
# SPDX-License-Identifier: GPL-2.0-or-later # Copyright (c) 2026 Steve Grubb _pscap() { local cur prev local opts="-a -p --tree" COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case "$prev" in -p) COMPREPLY=( $(compgen -W "$(ps -eo pid= 2>/dev/null)" \ -- "$cur") ) return 0 ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $(compgen -W "$opts" -- "$cur") ) fi } _netcap() { local cur prev local opts="--advanced --interface --list-interfaces --json --no-color" COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" case "$prev" in --interface) COMPREPLY=( $(compgen -W "$(command ls /sys/class/net \ 2>/dev/null)" -- "$cur") ) return 0 ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $(compgen -W "$opts" -- "$cur") ) fi } _filecap() { local cur prev local opts="-a -d" COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" if [[ "$cur" == -* ]]; then COMPREPLY=( $(compgen -W "$opts" -- "$cur") ) return 0 fi case "$prev" in -a|-d) return 0 ;; esac if [[ "$cur" == /* ]]; then COMPREPLY=( $(compgen -d -- "$cur") $(compgen -f -- "$cur") ) fi } _cap_audit() { local cur prev local opts="-h --help -v --verbose -j --json -y --yaml -s --service --" COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" if [[ "$prev" == "--" ]]; then COMPREPLY=( $(compgen -c -- "$cur") ) return 0 fi case "$prev" in -s|--service) COMPREPLY=( $(compgen -f -- "$cur") ) return 0 ;; esac if [[ "$cur" == -* ]]; then COMPREPLY=( $(compgen -W "$opts" -- "$cur") ) else COMPREPLY=( $(compgen -c -- "$cur") ) fi } complete -F _pscap pscap complete -F _netcap netcap complete -F _filecap filecap complete -F _cap_audit cap-audit