From c84ae81a12aecf900b6300dc7704315f357816b3 Mon Sep 17 00:00:00 2001 From: Justin Hileman Date: Mon, 17 Nov 2014 20:33:45 -0800 Subject: [PATCH] [bobthefish] DRY: we don't need two pwd-relative-to-project funcs --- themes/bobthefish/fish_prompt.fish | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/themes/bobthefish/fish_prompt.fish b/themes/bobthefish/fish_prompt.fish index 95f174e..5ce300b 100644 --- a/themes/bobthefish/fish_prompt.fish +++ b/themes/bobthefish/fish_prompt.fish @@ -104,16 +104,9 @@ function __bobthefish_project_dir_hg -d 'Print the current git project base dire end function __bobthefish_project_pwd -d 'Print the working directory relative to project root' - set -l base_dir (__bobthefish_project_dir) - echo "$PWD" | sed -e "s*$base_dir**g" -e 's*^/**' + echo "$PWD" | sed -e "s*$argv[1]**g" -e 's*^/**' end -function __bobthefish_project_pwd_hg -d 'Print the working directory relative to project root' - set -l base_dir (__bobthefish_project_dir_hg) - echo "$PWD" | sed -e "s*$base_dir**g" -e 's*^/**' -end - - # =========================== # Segment functions @@ -258,7 +251,7 @@ function __bobthefish_prompt_hg -d 'Display the actual hg state' echo -n -s (__bobthefish_hg_branch) $flags ' ' set_color normal - set -l project_pwd (__bobthefish_project_pwd_hg) + set -l project_pwd (__bobthefish_project_pwd (__bobthefish_project_dir_hg)) if test "$project_pwd" if test -w "$PWD" __bobthefish_start_segment 333 999 @@ -302,7 +295,7 @@ function __bobthefish_prompt_git -d 'Display the actual git state' echo -n -s (__bobthefish_git_branch) $flags ' ' set_color normal - set -l project_pwd (__bobthefish_project_pwd) + set -l project_pwd (__bobthefish_project_pwd (__bobthefish_project_dir)) if test "$project_pwd" if test -w "$PWD" __bobthefish_start_segment 333 999