function bm --description 'Navigate to and manage bookmarked directories' switch $argv[1] case add rm list -h --help command bm $argv return $status end set -l path (command bm --path $argv) set -l bm_status $status if test $bm_status -ne 0 return $bm_status end if test -z "$path" return 0 end if type -q pushd pushd $path else cd $path end end