Move setfacl completions to string

This commit is contained in:
Fabian Homborg 2015-09-29 16:40:47 +02:00
parent 55a2945449
commit 3b0f9911e2

View File

@ -7,19 +7,19 @@ function __fish_facl_list_spec_keyword
end
function __fish_facl_starts_with_spec_user
echo (commandline -ct) | __fish_sgrep -q -E 'u(ser)?:'
commandline -ct | string match -r "u(ser)?:"
end
function __fish_facl_starts_with_spec_group
echo (commandline -ct) | __fish_sgrep -q -E 'g(roup)?:'
commandline -ct | string match -r "g(roup)?:"
end
function __fish_facl_extract_acl
echo (commandline -ct) | __fish_sgrep -o -E '\w*:'
commandline -ct | string replace -ar '.*(\w*:).*' '$1'
end
complete -c setfacl -s m -s x -l modify -l remove -l set -n '__fish_facl_starts_with_spec_user' -a '(__fish_facl_extract_acl)(__fish_complete_users | sed "s/\t/:\t/g")'
complete -c setfacl -s m -s x -l modify -l remove -l set -n '__fish_facl_starts_with_spec_group' -a '(__fish_facl_extract_acl)(__fish_complete_groups | sed "s/\t/:\t/g")'
complete -c setfacl -s m -s x -l modify -l remove -l set -n '__fish_facl_starts_with_spec_user' -a '(__fish_facl_extract_acl)(__fish_complete_users | string replace -a "\t" ":\t")'
complete -c setfacl -s m -s x -l modify -l remove -l set -n '__fish_facl_starts_with_spec_group' -a '(__fish_facl_extract_acl)(__fish_complete_groups | string replace -a "\t" ":\t")'
complete -c setfacl -f -s m -s x -l modify -l remove -l set -a '(__fish_facl_list_spec_keyword)'
complete -c setfacl -s b -l remove-all --description 'Remove all extended ACL entries'