mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-25 09:39:52 +08:00
Replace uses of expr with math/string
This commit is contained in:
parent
962f9914c6
commit
158ea98189
|
@ -20,4 +20,4 @@ complete -c cower -f -s v -l 'verbose' -d 'Output more'
|
|||
|
||||
# Complete with AUR packages:
|
||||
# If the search string is too short, cower prints an annoying message to stderr - ignore that
|
||||
complete -c cower -f -n 'not expr -- (commandline --current-token) : "^\-.*" > /dev/null' -a '(cower --format="%n\t%d\n" --search (commandline --current-token) ^/dev/null)'
|
||||
complete -c cower -f -n 'not string match -q -- "-*" (commandline --current-token)' -a '(cower --format="%n\t%d\n" --search (commandline --current-token) ^/dev/null)'
|
||||
|
|
|
@ -15,7 +15,7 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowi
|
|||
for i in $cmd
|
||||
|
||||
if test $skip_next -gt 0
|
||||
set skip_next (expr $skip_next - 1)
|
||||
set skip_next (math $skip_next - 1)
|
||||
continue
|
||||
end
|
||||
|
||||
|
@ -24,7 +24,7 @@ function __fish_complete_subcommand -d "Complete subcommand" --no-scope-shadowi
|
|||
else
|
||||
|
||||
if contains -- $i $argv
|
||||
set skip_next (expr $skip_next + 1)
|
||||
set skip_next (math $skip_next + 1)
|
||||
continue
|
||||
end
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ function __fish_cursor_xterm -d 'Set cursor (xterm)'
|
|||
set shape 6
|
||||
end
|
||||
if contains blink $argv
|
||||
set shape (expr $shape - 1)
|
||||
set shape (math $shape - 1)
|
||||
end
|
||||
echo -en "\e[$shape q"
|
||||
end
|
||||
|
|
|
@ -1,10 +1,5 @@
|
|||
function __fish_is_token_n --description 'Test if current token is on Nth place' --argument n
|
||||
set -l num (count (commandline -poc))
|
||||
#if test $cur
|
||||
expr $n = $num + 1 > /dev/null
|
||||
#else
|
||||
#expr $n '=' $num + 1 > /dev/null
|
||||
#end
|
||||
|
||||
|
||||
# Add a fake element to increment without calling math
|
||||
set -l num (count (commandline -poc) additionalelement)
|
||||
test $n -eq $num
|
||||
end
|
||||
|
|
|
@ -36,7 +36,7 @@ function __fish_print_help --description "Print help message for the specified f
|
|||
end 3<&1
|
||||
end
|
||||
if test -n "$cols"
|
||||
set cols (expr $cols - 4) # leave a bit of space on the right
|
||||
set cols (math $cols - 4) # leave a bit of space on the right
|
||||
set rLL -rLL=$cols[1]n
|
||||
end
|
||||
set help (nroff -man -c -t $rLL "$__fish_datadir/man/man1/$item.1" ^/dev/null)
|
||||
|
|
|
@ -19,15 +19,11 @@ function contains_seq --description 'Return true if array contains a sequence'
|
|||
set -l i 1
|
||||
for s in $string
|
||||
if set -q printnext[2]
|
||||
#echo $s
|
||||
return 0
|
||||
end
|
||||
#echo a $nomatch
|
||||
if test "$s" = "$pattern[$i]"
|
||||
#echo b $nomatch
|
||||
#echo c $nomatch[1]
|
||||
set -e nomatch[1]
|
||||
set i (expr $i + 1)
|
||||
set i (math $i + 1)
|
||||
if not set -q pattern[$i]
|
||||
if set -q printnext[1]
|
||||
set printnext[2] 1
|
||||
|
|
Loading…
Reference in New Issue
Block a user