mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 15:18:50 +08:00
added functions to complete user and group IDs
This commit is contained in:
parent
660182cfb3
commit
f39cba1d9f
7
share/functions/__fish_complete_group_ids.fish
Normal file
7
share/functions/__fish_complete_group_ids.fish
Normal file
|
@ -0,0 +1,7 @@
|
|||
function __fish_complete_group_ids --description "Complete group IDs with group name as description"
|
||||
if command -sq getent
|
||||
getent group | string replace -f -r '^([[:alpha:]][^:]*):[^:]*:(\d+).*' '$2\t$1'
|
||||
else if test -r /etc/group
|
||||
string replace -f -r '^([[:alpha:]][^:]*):[^:]*:(\d+).*' '$2\t$1' < /etc/group
|
||||
end
|
||||
end
|
7
share/functions/__fish_complete_user_ids.fish
Normal file
7
share/functions/__fish_complete_user_ids.fish
Normal file
|
@ -0,0 +1,7 @@
|
|||
function __fish_complete_user_ids --description "Complete user IDs with user name as description"
|
||||
if command -sq getent
|
||||
getent passwd | string replace -f -r '^([[:alpha:]][^:]*):[^:]*:(\d+).*' '$2\t$1'
|
||||
else if test -r /etc/passwd
|
||||
string replace -f -r '^([[:alpha:]][^:]*):[^:]*:(\d+).*' '$2\t$1' < /etc/passwd
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user