Revert "convert popd and pushd to use argparse"

This reverts commit 05aae4764b.

Closes #4398.
This commit is contained in:
David Adam 2017-09-14 12:30:04 +08:00
parent 87924e3d4b
commit 725febb669
2 changed files with 16 additions and 17 deletions

View file

@ -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
__fish_print_help popd
return 0
function popd --description "Pop directory from the stack and cd to it"
if count $argv >/dev/null
switch $argv[1]
case -h --h --he --hel --help
__fish_print_help popd
return 0
end
end
if set -q dirstack[1]

View file

@ -1,16 +1,15 @@
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_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
if string match -qr '^-[0-9]+$' -- $argv[1]
set rot_r (string sub -s 2 -- $argv[1])