mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-23 18:56:51 +08:00
9367d4ff71
This does not include checks/function.fish because that currently includes a "; end" in a message that indent would remove, breaking the test.
21 lines
460 B
Fish
21 lines
460 B
Fish
function dirs --description 'Print directory stack'
|
|
set -l options h/help c
|
|
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
|
|
end
|
|
|
|
# Replace $HOME with ~.
|
|
string replace -r '^'"$HOME"'($|/)' '~$1' -- $PWD $dirstack | string join " "
|
|
echo
|
|
end
|