2015-07-09 02:54:49 +00:00
|
|
|
function dirs --description 'Print directory stack'
|
2020-03-09 18:36:12 +00:00
|
|
|
set -l options h/help c
|
2017-07-13 18:53:29 +00: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 05:27:22 +00:00
|
|
|
end
|
2006-02-12 13:14:21 +00:00
|
|
|
|
2017-07-13 18:53:29 +00:00
|
|
|
# Replace $HOME with ~.
|
2017-01-05 01:05:18 +00:00
|
|
|
string replace -r '^'"$HOME"'($|/)' '~$1' -- $PWD $dirstack | string join " "
|
2021-08-06 20:52:59 +00:00
|
|
|
return 0
|
2015-07-09 02:54:49 +00:00
|
|
|
end
|