X-Git-Url: https://yaffs.net/gitweb/?a=blobdiff_plain;f=vendor%2Fdrush%2Fdrush%2Fexamples%2Fexample.prompt.sh;h=adeab93019c183f05653419d5b6c5ff0921e7ecb;hb=1c1cb0980bfa6caf0c24cce671b6bb541dc87583;hp=fd8fee14dcdc722598b4db5c7d30bdd2e7b42015;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/vendor/drush/drush/examples/example.prompt.sh b/vendor/drush/drush/examples/example.prompt.sh index fd8fee14d..adeab9301 100644 --- a/vendor/drush/drush/examples/example.prompt.sh +++ b/vendor/drush/drush/examples/example.prompt.sh @@ -2,11 +2,37 @@ # # Example PS1 prompt. # -# Use `drush init` to copy this to ~/.drush/drush.prompt.sh, and source it in ~/.bashrc +# Use `drush init` to copy this to ~/.drush/drush.prompt.sh, and source it in +# ~/.bashrc or ~/.bash_profile. +# +# Note that your Bash session must already have the __git_ps1 function available. +# Typically this is provided by git-prompt.sh, see instructions for downloading +# and including this file here: +# https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh # # Features: # # Displays Git repository and Drush alias status in your prompt. + +__drush_ps1() { + f="${TMPDIR:-/tmp/}/drush-env-${USER}/drush-drupal-site-$$" + if [ -f $f ] + then + __DRUPAL_SITE=$(cat "$f") + else + __DRUPAL_SITE="$DRUPAL_SITE" + fi + + # Set DRUSH_PS1_SHOWCOLORHINTS to a non-empty value and define a + # __drush_ps1_colorize_alias() function for color hints in your Drush PS1 + # prompt. See example.prompt.sh for an example implementation. + if [ -n "${__DRUPAL_SITE-}" ] && [ -n "${DRUSH_PS1_SHOWCOLORHINTS-}" ]; then + __drush_ps1_colorize_alias + fi + + [[ -n "$__DRUPAL_SITE" ]] && printf "${1:- (%s)}" "$__DRUPAL_SITE" +} + if [ -n "$(type -t __git_ps1)" ] && [ "$(type -t __git_ps1)" = function ] && [ "$(type -t __drush_ps1)" ] && [ "$(type -t __drush_ps1)" = function ]; then # This line enables color hints in your Drush prompt. Modify the below