mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-12 21:18:53 +00:00
Revert "convert popd
and pushd
to use argparse
"
This reverts commit 05aae4764b
.
Closes #4398.
This commit is contained in:
parent
87924e3d4b
commit
725febb669
2 changed files with 16 additions and 17 deletions
|
@ -1,11 +1,11 @@
|
||||||
function popd --description "Pop directory from the stack and cd to it"
|
|
||||||
set -l options 'h/help'
|
|
||||||
argparse -n popd --max-args=0 $options -- $argv
|
|
||||||
or return
|
|
||||||
|
|
||||||
if set -q _flag_help
|
function popd --description "Pop directory from the stack and cd to it"
|
||||||
__fish_print_help popd
|
if count $argv >/dev/null
|
||||||
return 0
|
switch $argv[1]
|
||||||
|
case -h --h --he --hel --help
|
||||||
|
__fish_print_help popd
|
||||||
|
return 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if set -q dirstack[1]
|
if set -q dirstack[1]
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
function pushd --description 'Push directory to stack'
|
function pushd --description 'Push directory to stack'
|
||||||
set -l options 'h/help'
|
|
||||||
argparse -n pushd --max-args=1 $options -- $argv
|
|
||||||
or return
|
|
||||||
|
|
||||||
if set -q _flag_help
|
|
||||||
__fish_print_help pushd
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
|
|
||||||
set -l rot_r
|
set -l rot_r
|
||||||
set -l rot_l
|
set -l rot_l
|
||||||
if set -q argv[1]
|
|
||||||
|
if count $argv >/dev/null
|
||||||
|
# check for --help
|
||||||
|
switch $argv[1]
|
||||||
|
case -h --h --he --hel --help
|
||||||
|
__fish_print_help pushd
|
||||||
|
return 0
|
||||||
|
end
|
||||||
|
|
||||||
# emulate bash by checking if argument of form +n or -n
|
# emulate bash by checking if argument of form +n or -n
|
||||||
if string match -qr '^-[0-9]+$' -- $argv[1]
|
if string match -qr '^-[0-9]+$' -- $argv[1]
|
||||||
set rot_r (string sub -s 2 -- $argv[1])
|
set rot_r (string sub -s 2 -- $argv[1])
|
||||||
|
|
Loading…
Reference in a new issue