diff options
author | Oliver Kiddle <opk@zsh.org> | 2023-11-17 18:25:21 +0100 |
---|---|---|
committer | Oliver Kiddle <opk@zsh.org> | 2023-11-17 18:25:21 +0100 |
commit | 8f0a8131fad30c627d72f24a6a88ac0053cd3790 (patch) | |
tree | b9442700fafcf8ffad122998ff6137c0bb5a8f75 /Completion/Linux/Type/_selinux_types | |
parent | 6306dcfaa52237fbaa76eafe7bc396e68eda66ca (diff) | |
download | zsh-8f0a8131fad30c627d72f24a6a88ac0053cd3790.tar.gz zsh-8f0a8131fad30c627d72f24a6a88ac0053cd3790.tar.xz zsh-8f0a8131fad30c627d72f24a6a88ac0053cd3790.zip |
52307: new completion for many SELinux tools
Diffstat (limited to 'Completion/Linux/Type/_selinux_types')
-rw-r--r-- | Completion/Linux/Type/_selinux_types | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/Completion/Linux/Type/_selinux_types b/Completion/Linux/Type/_selinux_types index ef31f45d2..69047c690 100644 --- a/Completion/Linux/Type/_selinux_types +++ b/Completion/Linux/Type/_selinux_types @@ -1,7 +1,19 @@ #autoload -local -a setypes expl +# Pass -a attribute to filter types, e.g.: +# -a domain - for process types +# -a file_type - for file types +# -a port_type - for network ports + +local -a setypes expl extra + +zparseopts -E -D -a extra a: + +if (( $#extra )); then + setypes=( ${${${(f)"$(_call_program selinux-types seinfo $extra --flat -x)"}#[[:blank:]]}:1} ) +else + setypes=( ${(f)"$(_call_program selinux-types seinfo --flat -t)"} ) +fi -setypes=( ${(f)"$(_call_program selinux-types seinfo --flat -t)"} ) _description selinux-types expl "selinux type" compadd "$@" "$expl[@]" -a setypes |