From 566f1e29f8b6978dcfa31f9f4b96abcc777b93bc Mon Sep 17 00:00:00 2001 From: Toni Uebernickel Date: Fri, 12 Jun 2015 13:23:06 +0200 Subject: [PATCH] allow custom callback to re-use build_prompt --- base.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/base.sh b/base.sh index 5be07b3..c76d67b 100644 --- a/base.sh +++ b/base.sh @@ -49,6 +49,8 @@ function get_current_action () { } function build_prompt { + local callback=${1:='custom_build_prompt'} + local enabled=`git config --local --get oh-my-git.enabled` if [[ ${enabled} == false ]]; then echo "${PSORG}" @@ -104,8 +106,7 @@ function build_prompt { fi fi - echo "$(custom_build_prompt ${enabled:-true} ${current_commit_hash:-""} ${is_a_git_repo:-false} ${current_branch:-""} ${detached:-false} ${just_init:-false} ${has_upstream:-false} ${has_modifications:-false} ${has_modifications_cached:-false} ${has_adds:-false} ${has_deletions:-false} ${has_deletions_cached:-false} ${has_untracked_files:-false} ${ready_to_commit:-false} ${tag_at_current_commit:-""} ${is_on_a_tag:-false} ${has_upstream:-false} ${commits_ahead:-false} ${commits_behind:-false} ${has_diverged:-false} ${should_push:-false} ${will_rebase:-false} ${has_stashes:-false} ${action})" - + echo "$(${callback} ${enabled:-true} ${current_commit_hash:-""} ${is_a_git_repo:-false} ${current_branch:-""} ${detached:-false} ${just_init:-false} ${has_upstream:-false} ${has_modifications:-false} ${has_modifications_cached:-false} ${has_adds:-false} ${has_deletions:-false} ${has_deletions_cached:-false} ${has_untracked_files:-false} ${ready_to_commit:-false} ${tag_at_current_commit:-""} ${is_on_a_tag:-false} ${has_upstream:-false} ${commits_ahead:-false} ${commits_behind:-false} ${has_diverged:-false} ${should_push:-false} ${will_rebase:-false} ${has_stashes:-false} ${action})" } function_exists() {