2020-04-15 01:25:57 +08:00
|
|
|
function __fish_complete_su_env_whitelist
|
|
|
|
env | string match -v -e -r '^(?:HOME|SHELL|USER|LOGNAME|PATH)=' | string replace -r '([^=]+)=(.*)' '$1\t$2'
|
|
|
|
end
|
|
|
|
|
|
|
|
complete -c su -x -a "(__fish_complete_users)"
|
2005-09-20 21:31:55 +08:00
|
|
|
|
2017-10-12 01:17:35 +08:00
|
|
|
complete -c su -s l -l login -d "Make login shell"
|
2019-11-04 06:55:54 +08:00
|
|
|
complete -c su -s c -l command -d "Pass command to shell" -xa "(__fish_complete_external_command)"
|
2017-10-12 01:17:35 +08:00
|
|
|
complete -c su -s f -l fast -d "Pass -f to the shell"
|
2020-04-15 01:25:57 +08:00
|
|
|
complete -c su -s g -l group -x -a "(__fish_complete_groups)" -d "Specify the primary group"
|
|
|
|
complete -c su -s G -l supp-group -x -a "(__fish_complete_groups)" -d "Specify a supplemental group"
|
|
|
|
complete -c su -s m -s p -l preserve_environment -d "Preserve environment"
|
|
|
|
complete -c su -s P -l pty -d "Create pseudo-terminal for the session"
|
|
|
|
complete -c su -s s -l shell -x -a "(cat /etc/shells)" -d "Run the specified shell"
|
|
|
|
complete -c su -s w -l whitelist-environment -x -a "(__fish_complete_list , __fish_complete_su_env_whitelist)" -d "Don't reset these environment variables"
|
|
|
|
complete -c su -s h -l help -d "Display help and exit"
|
|
|
|
complete -c su -s V -l version -d "Display version and exit"
|