Add long style option support for prevd/pushd, also add a few missing translation strings

darcs-hash:20060206112453-ac50b-271b830b35176d1ff93d9d9fb6c30343b4f1b4df.gz
This commit is contained in:
axel 2006-02-06 21:24:53 +10:00
parent 04ce9ecf16
commit c743ebf211
3 changed files with 33 additions and 31 deletions

View file

@ -1,9 +1,10 @@
\section nextd nextd \section nextd nextd
\subsection nextd-synopsis Synopsis \subsection nextd-synopsis Synopsis
<tt>nextd [-l] [pos]</tt> <tt>nextd [-l | --list] [pos]</tt>
\subsection nextd-description Description \subsection nextd-description Description <tt>nextd</tt> moves
<tt>nextd</tt> moves forwards <tt>pos</tt> positions in the history of visited directories; forwards <tt>pos</tt> positions in the history of visited directories;
if the end of the history has been hit, a warning is printed. If the <tt>-l></tt> flag is if the end of the history has been hit, a warning is printed. If the
specified, the current history is also displayed. <code>-l></code> or <code>--list</code> flag is specified, the current
history is also displayed.

View file

@ -1,9 +1,10 @@
\section prevd prevd \section prevd prevd
\subsection prevd-synopsis Synopsis \subsection prevd-synopsis Synopsis
<tt>prevd [-l] [pos]</tt> <tt>prevd [-l | --list] [pos]</tt>
\subsection prevd-description Description \subsection prevd-description Description <tt>prevd</tt> moves
<tt>prevd</tt> moves backwards <tt>pos</tt> positions in the history of visited directories; backwards <tt>pos</tt> positions in the history of visited
if the beginning of the history has been hit, a warning is printed. If the <tt>-l</tt> flag directories; if the beginning of the history has been hit, a warning
is specified, the current history is also displayed. is printed. If the <code>-l</code> or <code>--list</code> flag is
specified, the current history is also displayed.

View file

@ -218,7 +218,7 @@ function vared -d "Edit variable value"
help vared help vared
case '-*' case '-*'
printf "vared: Unknown option %s\n" $argv printf (_ "%s: Unknown option %s\n") vared $argv
case '*' case '*'
if test (count $$argv ) -lt 2 if test (count $$argv ) -lt 2
@ -243,11 +243,11 @@ function vared -d "Edit variable value"
else else
printf (_ 'vared: %s is an array variable. Use %svared%s %s[n] to edit the n:th element of %s\n') $argv (set_color $fish_color_command) (set_color $fish_color_normal) $argv $argv printf (_ '%s: %s is an array variable. Use %svared%s %s[n] to edit the n:th element of %s\n') $argv (set_color $fish_color_command) (set_color $fish_color_normal) vared $argv $argv
end end
end end
else else
printf (_ 'vared: Expected exactly one argument, got %s.\n\nSynopsis:\n\t%svared%s VARIABLE\n') (count $argv) (set_color $fish_color_command) (set_color $fish_color_normal) printf (_ '%s: Expected exactly one argument, got %s.\n\nSynopsis:\n\t%svared%s VARIABLE\n') vared (count $argv) (set_color $fish_color_command) (set_color $fish_color_normal)
end end
end end
@ -290,7 +290,7 @@ function popd -d "Pop dir from stack"
if test $dirstack[1] if test $dirstack[1]
cd $dirstack[1] cd $dirstack[1]
else else
echo Directory stack is empty... printf (_ "%s: Directory stack is empty...") popd
return 1 return 1
end end
@ -345,10 +345,10 @@ end
function __fish_move_last -d "Move the last element of a directory history from src to dest" function __fish_move_last -d "Move the last element of a directory history from src to dest"
set src $argv[1] set -l src $argv[1]
set dest $argv[2] set -l dest $argv[2]
set size_src (count $$src) set -l size_src (count $$src)
if test $size_src = 0 if test $size_src = 0
# Cannot make this step # Cannot make this step
@ -374,15 +374,15 @@ end
function prevd -d "Move back in the directory history" function prevd -d "Move back in the directory history"
# Parse arguments # Parse arguments
set show_hist 0 set -l show_hist 0
set times 1 set -l times 1
for i in (seq (count $argv)) for i in (seq (count $argv))
switch $argv[$i] switch $argv[$i]
case '-l' case '-l' --l --li --lis --list
set show_hist 1 set show_hist 1
continue continue
case '-*' case '-*'
echo Uknown option $argv[$i] printf (_ "%s: Unknown option %s\n" ) prevd $argv[$i]
return 1 return 1
case '*' case '*'
if test $argv[$i] -ge 0 ^/dev/null if test $argv[$i] -ge 0 ^/dev/null
@ -396,7 +396,7 @@ function prevd -d "Move back in the directory history"
end end
# Traverse history # Traverse history
set code 1 set -l code 1
for i in (seq $times) for i in (seq $times)
# Try one step backward # Try one step backward
if __fish_move_last dirprev dirnext; if __fish_move_last dirprev dirnext;
@ -425,21 +425,21 @@ end
function nextd -d "Move forward in the directory history" function nextd -d "Move forward in the directory history"
# Parse arguments # Parse arguments
set show_hist 0 set -l show_hist 0
set times 1 set -l times 1
for i in (seq (count $argv)) for i in (seq (count $argv))
switch $argv[$i] switch $argv[$i]
case '-l' case '-l' --l --li --lis --list
set show_hist 1 set show_hist 1
continue continue
case '-*' case '-*'
echo Uknown option $argv[$i] printf (_ "%s: Unknown option %s\n" ) nextd $argv[$i]
return 1 return 1
case '*' case '*'
if test $argv[$i] -ge 0 ^/dev/null if test $argv[$i] -ge 0 ^/dev/null
set times $argv[$i] set times $argv[$i]
else else
echo "The number of positions to skip must be a non-negative integer" printf (_ "%s: The number of positions to skip must be a non-negative integer\n" ) nextd
return 1 return 1
end end
continue continue
@ -447,7 +447,7 @@ function nextd -d "Move forward in the directory history"
end end
# Traverse history # Traverse history
set code 1 set -l code 1
for i in (seq $times) for i in (seq $times)
# Try one step backward # Try one step backward
if __fish_move_last dirnext dirprev; if __fish_move_last dirnext dirprev;
@ -476,9 +476,9 @@ end
function dirh -d "Print the current directory history (the back- and fwd- lists)" function dirh -d "Print the current directory history (the back- and fwd- lists)"
# Avoid set comment # Avoid set comment
set current (command pwd) set -l current (command pwd)
set -- separator " " set -l separator " "
set -- line_len (echo (count $dirprev) + (echo $dirprev $current $dirnext | wc -m) | bc) set -l line_len (echo (count $dirprev) + (echo $dirprev $current $dirnext | wc -m) | bc)
if test $line_len -gt $COLUMNS if test $line_len -gt $COLUMNS
# Print one entry per line if history is long # Print one entry per line if history is long
set separator "\n" set separator "\n"