Add bash-git-prompt in order to have a more descriptive prompt when working with repositories.

Also, update documentation for bash-git-prompt usage
This commit is contained in:
Scott Collier 2020-01-20 12:24:18 -06:00
parent ad2b455be5
commit b28f449556
5 changed files with 58 additions and 0 deletions

View File

@ -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> <br>
<a name="phpstorm-debugging"></a> <a name="phpstorm-debugging"></a>
## PHPStorm Debugging Guide ## PHPStorm Debugging Guide

View File

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

View File

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

View File

@ -1253,6 +1253,19 @@ RUN if [ ${INSTALL_GNU_PARALLEL} = true ]; then \
apt-get -y install parallel \ apt-get -y install parallel \
;fi ;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: # Check PHP version:

24
workspace/git-prompt.sh Normal file
View File

@ -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