aboutsummaryrefslogtreecommitdiffhomepage
path: root/share/functions/__fish_complete_lpr_option.fish
diff options
context:
space:
mode:
authorGravatar Fabian Homborg <FHomborg@gmail.com>2016-02-03 23:26:41 +0100
committerGravatar Fabian Homborg <FHomborg@gmail.com>2016-02-03 23:26:41 +0100
commit16aa0b93e92178796c05249b384e5f5dabf52f4a (patch)
treea1045796933adfbba6791cec87bb4c98aa8a868b /share/functions/__fish_complete_lpr_option.fish
parent158ea98189f6c5c410ea8b58f466a5ef6a8f1a33 (diff)
Stringify __fish_complete_lpr_option
Diffstat (limited to 'share/functions/__fish_complete_lpr_option.fish')
-rw-r--r--share/functions/__fish_complete_lpr_option.fish12
1 files changed, 4 insertions, 8 deletions
diff --git a/share/functions/__fish_complete_lpr_option.fish b/share/functions/__fish_complete_lpr_option.fish
index aa9d981f..e593aab4 100644
--- a/share/functions/__fish_complete_lpr_option.fish
+++ b/share/functions/__fish_complete_lpr_option.fish
@@ -5,24 +5,20 @@ function __fish_complete_lpr_option --description 'Complete lpr option'
set -l IFS =
echo $optstr | read -l opt val
set -l descr
- # Some seds (e.g. on Mac OS X), don't support \n in the RHS
- # Use a literal newline instead
- # http://sed.sourceforge.net/sedfaq4.html#s4.1
- for l in (lpoptions -l ^ /dev/null | grep $opt | sed 's+\(.*\)/\(.*\):\s*\(.*\)$+\2 \3+; s/ /\\
-/g;')
+ for l in (lpoptions -l ^/dev/null | string match -- "*$opt*" | string replace -r '.*/(.*):\s*(.*)$' '$1 $2' | string split " ")
if not set -q descr[1]
set descr $l
continue
end
set -l default ''
- if test (expr substr $l 1 1) = '*'
+ if string match -q '\**' -- $l
set default 'Default '
- set l (echo $l | sed 's/\*//')
+ set l (string sub -s 2 -- $l)
end
echo $opt=$l\t$default$descr
end
case '*'
- lpoptions -l ^ /dev/null | sed 's+\(.*\)/\(.*\):.*$+\1=\t\2+'
+ lpoptions -l ^/dev/null | string replace -r '(.*)/(.*):.*$' '$1=\t$2'
end