feat(aa-log): add bash & improve zsh completion.

This commit is contained in:
Alexandre Pujol 2022-09-13 18:15:47 +01:00
parent 0177b68308
commit 80bb01ad3c
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
2 changed files with 35 additions and 8 deletions

View file

@ -1,22 +1,23 @@
#compdef aa-log
#autoload
_aa-log () {
_aa-log() {
local IFS=$'\n'
_arguments : \
-f'[set a logfile or a prefix to the default log file]:_files' \
-f'[set a logfile or a prefix to the default log file]:FILE:__aa_files' \
-d'[show dbus session event]' \
-h'[display help information]'
_values -C 'profile names' ${$(__aa_profiles):-""}
}
__aa_files() {
find /var/log/audit/ -type f -printf '%P\n' | cut -d '.' -f 3
_files
}
__aa_profiles() {
find -L /etc/apparmor.d -type f -printf '%P\n' \
| sed -e '/abi/d' \
-e '/abstractions/d' \
-e '/local/d' \
-e '/tunables/d' \
| sort
find -L /etc/apparmor.d -maxdepth 1 -type f -printf '%P\n' | sort
}
_aa-log