configs  prompt_pwd.fish at 24d2eb82f0b4e25d7bd29f47b75470c518528c55c4483325ec2dd97f4236b50c

File fish/functions/prompt_pwd.fish artifact be6aa8e75b part of check-in 24d2eb82f0b4e25d7bd29f47b75470c518528c55c4483325ec2dd97f4236b50c


function prompt_pwd --description 'Print the current working directory'
    set -l options 'h/help'
    argparse -n prompt_pwd --max-args=0 $options -- $argv
    or return

    if set -q _flag_help
        __fish_print_help prompt_pwd
        return 0
    end

    # Replace $HOME with "~"
    set realhome ~
    set -l tmp (basename (string replace -r '^'"$realhome"'($|/)' '~$1' $PWD))

    test $PWD = "/$tmp"
    and set tmp $PWD

    echo $tmp
end