fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
d835c5252
master
1# localization: tier1 2function nextd --description"Move forward in the directory history" 3set -l options h/help l/list 4argparse -n nextd --max-args=1$options --$argv 5or return 6 7if set -q _flag_help 8__fish_print_help nextd 9return 0 10end 11 12set -l times1 13if set -q argv[ 1 ] 14if test $argv [ 1 ] -ge 0 2> /dev/null 15set times$argv [ 1 ] 16else 17printf ( _ "%s: The number of positions to skip must be a non-negative integer\n" ) nextd>&2 18return 1 19end 20end 21 22# Traverse history 23set -l code1 24for iin ( seq $times ) 25# Try one step backward 26if __fish_move_last dirnext dirprev 27# We consider it a success if we were able to do at least 1 step 28# (low expectations are the key to happiness ;) 29set code0 30else 31break 32end 33end 34 35# Show history if needed 36if set -q _flag_list 37dirh 38end 39 40# Set direction for 'cd -' 41test $code = 0 42and set -g __fish_cd_direction prev 43 44return $code 45end