Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / drush / drush / examples / example.prompt.sh
index fd8fee14dcdc722598b4db5c7d30bdd2e7b42015..adeab93019c183f05653419d5b6c5ff0921e7ecb 100644 (file)
@@ -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