From 30940916bdd0dbe06e00059beac2d32c39aa91e3 Mon Sep 17 00:00:00 2001 From: Kurtis Rader Date: Thu, 13 Jul 2017 13:57:17 -0700 Subject: [PATCH] update `prompt_pwd` to use `argparse` --- share/functions/prompt_pwd.fish | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/share/functions/prompt_pwd.fish b/share/functions/prompt_pwd.fish index 71dfc461e..c57f3a69a 100644 --- a/share/functions/prompt_pwd.fish +++ b/share/functions/prompt_pwd.fish @@ -1,9 +1,11 @@ function prompt_pwd --description "Print the current working directory, shortened to fit the prompt" - set -q argv[1] - and switch $argv[1] - case -h --help - __fish_print_help prompt_pwd - return 0 + 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 # This allows overriding fish_prompt_pwd_dir_length from the outside (global or universal) without leaking it