From 30baf8d1014274881d355bbc899541ab26072ff6 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Thu, 13 Jul 2017 11:50:57 -0700 Subject: [PATCH] convert `dirh` to use `argparse` --- share/functions/dirh.fish | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/share/functions/dirh.fish b/share/functions/dirh.fish index 5ebea4bc4..60c205cb2 100644 --- a/share/functions/dirh.fish +++ b/share/functions/dirh.fish @@ -1,10 +1,11 @@ function dirh --description "Print the current directory history (the prev and next lists)" - if set -q argv[1] - switch $argv[1] - case -h --h --he --hel --help - __fish_print_help dirh - return 0 - end + set -l options 'h/help' + argparse -n dirh --max-args=0 $options -- $argv + or return + + if set -q _flag_help + __fish_print_help dirh + return 0 end set -l dirc (count $dirprev) @@ -25,6 +26,5 @@ function dirh --description "Print the current directory history (the prev and n printf '%2d) %s\n' $i $dirnext[$i] end end - echo end