mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:57:30 +08:00
dogfood string split -f
This commit is contained in:
parent
3bb86d3a61
commit
f66285d7a1
|
@ -1,6 +1,6 @@
|
|||
function __fish_xprop_list_properties
|
||||
# TODO search commandline for a target window ("-root" or "-name foo")
|
||||
xprop -root | cut -d'(' -f 1
|
||||
xprop -root | string split -f1 '('
|
||||
end
|
||||
|
||||
complete -c xprop -o help -d "Display help and exit"
|
||||
|
@ -19,4 +19,3 @@ complete -c xprop -o set -d "Set property" -x -a " (__fish_xprop_list_properties
|
|||
complete -c xprop -o spy -d "Examine property updates forever"
|
||||
complete -c xprop -o f -d "Set format"
|
||||
complete -c xprop -d Property -x -a "( __fish_xprop_list_properties)"
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
function __fish_complete_gpg_user_id -d "Complete using gpg user ids" -a __fish_complete_gpg_command
|
||||
# gpg doesn't seem to like it when you use the whole key name as a
|
||||
# completion, so we skip the <EMAIL> part and use it as a
|
||||
# description.
|
||||
# It also replaces colons with \x3a
|
||||
$__fish_complete_gpg_command --list-keys --with-colon | cut -d : -f 10 | sed -ne 's/\\\x3a/:/g' -e 's/\(.*\) <\(.*\)>/\1'\t'\2/p'
|
||||
# completion, so we skip the <EMAIL> part and use it as a description.
|
||||
# It also replaces \x3a from gpg's output with colons.
|
||||
$__fish_complete_gpg_command --list-keys --with-colon | string split -a -f 10 : | string replace '\x3a' : | string replace -rf '(.*) <(.*)>' '$1\t$2'
|
||||
end
|
||||
|
|
|
@ -1,8 +1,12 @@
|
|||
|
||||
function __fish_complete_groups --description "Print a list of local groups, with group members as the description"
|
||||
if command -sq getent
|
||||
getent group | cut -d ':' -f 1,4 | string replace : \t
|
||||
getent group | while read -l line
|
||||
string split -f 1,4 : -- $line | string join \t
|
||||
end
|
||||
else
|
||||
cut -d ':' -f 1,4 /etc/group | string replace : \t
|
||||
while read -l line
|
||||
string split -f 1,4 : -- $line | string join \t
|
||||
end </etc/group
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# a function to obtain a list of installed packages with CRUX pkgutils
|
||||
function __fish_crux_packages -d 'Obtain a list of installed packages'
|
||||
pkginfo -i | cut -d' ' -f1
|
||||
pkginfo -i | string split -f1 ' '
|
||||
end
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
function __fish_systemctl_services
|
||||
if type -q systemctl
|
||||
if __fish_contains_opt user
|
||||
systemctl --user list-unit-files --full --no-legend --no-pager --plain --type=service 2>/dev/null $argv | cut -f 1 -d ' '
|
||||
systemctl --user list-units --state=loaded --full --no-legend --no-pager --plain --type=service 2>/dev/null | cut -f 1 -d ' '
|
||||
systemctl --user list-unit-files --full --no-legend --no-pager --plain --type=service 2>/dev/null $argv | string split -f 1 ' '
|
||||
systemctl --user list-units --state=loaded --full --no-legend --no-pager --plain --type=service 2>/dev/null | string split -f 1 ' '
|
||||
else
|
||||
# list-unit-files will also show disabled units
|
||||
systemctl list-unit-files --full --no-legend --no-pager --plain --type=service 2>/dev/null $argv | cut -f 1 -d ' '
|
||||
systemctl list-unit-files --full --no-legend --no-pager --plain --type=service 2>/dev/null $argv | string split -f 1 ' '
|
||||
# list-units will not show disabled units but will show instances (like wpa_supplicant@wlan0.service)
|
||||
systemctl list-units --state=loaded --full --no-legend --no-pager --plain --type=service 2>/dev/null | cut -f 1 -d ' '
|
||||
systemctl list-units --state=loaded --full --no-legend --no-pager --plain --type=service 2>/dev/null | string split -f 1 ' '
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue
Block a user