2015-07-09 10:54:49 +08:00
|
|
|
function dirs --description 'Print directory stack'
|
2020-03-10 02:36:12 +08:00
|
|
|
set -l options h/help c
|
2017-07-14 02:53:29 +08:00
|
|
|
argparse -n dirs --max-args=0 $options -- $argv
|
|
|
|
or return
|
|
|
|
|
|
|
|
if set -q _flag_help
|
|
|
|
__fish_print_help dirs
|
|
|
|
return 0
|
|
|
|
end
|
|
|
|
|
|
|
|
if set -q _flag_c
|
|
|
|
# Clear directory stack.
|
|
|
|
set -e -g dirstack
|
|
|
|
return 0
|
2016-11-28 13:27:22 +08:00
|
|
|
end
|
2006-02-12 21:14:21 +08:00
|
|
|
|
2017-07-14 02:53:29 +08:00
|
|
|
# Replace $HOME with ~.
|
2017-01-05 09:05:18 +08:00
|
|
|
string replace -r '^'"$HOME"'($|/)' '~$1' -- $PWD $dirstack | string join " "
|
2015-07-09 10:54:49 +08:00
|
|
|
end
|