Преглед на файлове

Add bash-git-prompt in order to have a more descriptive prompt when working with repositories.
Also, update documentation for bash-git-prompt usage

Scott Collier преди 5 години
родител
ревизия
b28f449556
променени са 5 файла, в които са добавени 58 реда и са изтрити 0 реда
  1. 19 0
      DOCUMENTATION/content/documentation/index.md
  2. 1 0
      docker-compose.yml
  3. 1 0
      env-example
  4. 13 0
      workspace/Dockerfile
  5. 24 0
      workspace/git-prompt.sh

+ 19 - 0
DOCUMENTATION/content/documentation/index.md

@@ -2052,6 +2052,25 @@ AST exposes the abstract syntax tree generated by PHP 7+. This extension is requ
 
 
 
+<br>
+<a name="Install-Bash-Git-Prompt"></a>
+## Install Git Bash Prompt
+A bash prompt that displays information about the current git repository. In particular the branch name, difference with remote branch, number of files staged, changed, etc.
+
+1 - Open the `.env` file
+
+2 - Search for the `WORKSPACE_INSTALL_GIT_PROMPT` argument under the Workspace Container
+
+3 - Set it to `true`
+
+4 - Re-build the container `docker-compose build workspace`
+
+**Note** You can configure bash-git-prompt by editing the `workspace/gitprompt.sh` file and re-building the workspace container.
+For configuration information, visit the [bash-git-prompt repository](https://github.com/magicmonty/bash-git-prompt).
+
+
+
+
 <br>
 <a name="phpstorm-debugging"></a>
 ## PHPStorm Debugging Guide

+ 1 - 0
docker-compose.yml

@@ -125,6 +125,7 @@ services:
           - INSTALL_AST=${WORKSPACE_INSTALL_AST}
           - INSTALL_YAML=${WORKSPACE_INSTALL_YAML}
           - INSTALL_MAILPARSE=${WORKSPACE_INSTALL_MAILPARSE}
+          - INSTALL_GIT_PROMPT=${WORKSPACE_INSTALL_GIT_PROMPT}
           - PUID=${WORKSPACE_PUID}
           - PGID=${WORKSPACE_PGID}
           - CHROME_DRIVER_VERSION=${WORKSPACE_CHROME_DRIVER_VERSION}

+ 1 - 0
env-example

@@ -158,6 +158,7 @@ WORKSPACE_INSTALL_FFMPEG=false
 WORKSPACE_INSTALL_GNU_PARALLEL=false
 WORKSPACE_INSTALL_AST=true
 WORKSPACE_AST_VERSION=1.0.3
+WORKSPACE_INSTALL_GIT_PROMPT=true
 
 ### PHP_FPM ###############################################
 

+ 13 - 0
workspace/Dockerfile

@@ -1253,6 +1253,19 @@ RUN if [ ${INSTALL_GNU_PARALLEL} = true ]; then \
   apt-get -y install parallel \
 ;fi
 
+###########################################################################
+# Bash Git Prompt
+###########################################################################
+
+ARG INSTALL_GIT_PROMPT=false
+
+COPY git-prompt.sh /tmp/git-prompt
+
+RUN if [ ${INSTALL_GIT_PROMPT} = true ]; then \
+    git clone https://github.com/magicmonty/bash-git-prompt.git /root/.bash-git-prompt --depth=1 && \
+    cat /tmp/git-prompt >> /root/.bashrc && \
+    rm /tmp/git-prompt \
+;fi
 
 ###########################################################################
 # Check PHP version:

+ 24 - 0
workspace/git-prompt.sh

@@ -0,0 +1,24 @@
+# Settings info at https://github.com/magicmonty/bash-git-prompt
+if [ -f "$HOME/.bash-git-prompt/gitprompt.sh" ]; then
+    # Set config variables first
+    GIT_PROMPT_ONLY_IN_REPO=1
+    GIT_PROMPT_FETCH_REMOTE_STATUS=0    # uncomment to avoid fetching remote status
+    GIT_PROMPT_IGNORE_SUBMODULES=1      # uncomment to avoid searching for changed files in submodules
+    # GIT_PROMPT_WITH_VIRTUAL_ENV=0     # uncomment to avoid setting virtual environment infos for node/python/conda environments
+
+    # GIT_PROMPT_SHOW_UPSTREAM=1        # uncomment to show upstream tracking branch
+    # GIT_PROMPT_SHOW_UNTRACKED_FILES=normal    # can be no, normal or all; determines counting of untracked files
+
+    # GIT_PROMPT_SHOW_CHANGED_FILES_COUNT=0     # uncomment to avoid printing the number of changed files
+
+    # GIT_PROMPT_STATUS_COMMAND=gitstatus_pre-1.7.10.sh # uncomment to support Git older than 1.7.10
+
+    # GIT_PROMPT_START=...    # uncomment for custom prompt start sequence
+    # GIT_PROMPT_END=...      # uncomment for custom prompt end sequence
+
+    # as last entry source the gitprompt script
+    # GIT_PROMPT_THEME=Custom # use custom theme specified in file GIT_PROMPT_THEME_FILE (default ~/.git-prompt-colors.sh)
+    # GIT_PROMPT_THEME_FILE=~/.git-prompt-colors.sh
+    # GIT_PROMPT_THEME=Solarized # use theme optimized for solarized color scheme
+    source $HOME/.bash-git-prompt/gitprompt.sh
+fi