From b28f44955681244da1a7b04c013a667ae68b825d Mon Sep 17 00:00:00 2001 From: Scott Collier Date: Mon, 20 Jan 2020 12:24:18 -0600 Subject: [PATCH 1/2] Add bash-git-prompt in order to have a more descriptive prompt when working with repositories. Also, update documentation for bash-git-prompt usage --- DOCUMENTATION/content/documentation/index.md | 19 ++++++++++++++++ docker-compose.yml | 1 + env-example | 1 + workspace/Dockerfile | 13 +++++++++++ workspace/git-prompt.sh | 24 ++++++++++++++++++++ 5 files changed, 58 insertions(+) create mode 100644 workspace/git-prompt.sh diff --git a/DOCUMENTATION/content/documentation/index.md b/DOCUMENTATION/content/documentation/index.md index 14d5be0..d007bca 100644 --- a/DOCUMENTATION/content/documentation/index.md +++ b/DOCUMENTATION/content/documentation/index.md @@ -2052,6 +2052,25 @@ AST exposes the abstract syntax tree generated by PHP 7+. This extension is requ +
+ +## 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). + + + +
## PHPStorm Debugging Guide diff --git a/docker-compose.yml b/docker-compose.yml index 7f1543f..bb75128 100644 --- a/docker-compose.yml +++ b/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} diff --git a/env-example b/env-example index feecbd6..256288d 100644 --- a/env-example +++ b/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 ############################################### diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 6223e0a..3bf6872 100644 --- a/workspace/Dockerfile +++ b/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: diff --git a/workspace/git-prompt.sh b/workspace/git-prompt.sh new file mode 100644 index 0000000..374e9fa --- /dev/null +++ b/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 From 7fec2186ef0a140a19c603d7406614bb4c321e18 Mon Sep 17 00:00:00 2001 From: Scott Collier Date: Mon, 20 Jan 2020 12:25:44 -0600 Subject: [PATCH 2/2] Add bash-git-prompt in order to have a more descriptive prompt when working with repositories. Also, update documentation for bash-git-prompt usage. Make sure initial value for usage is false. --- env-example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/env-example b/env-example index 256288d..a98d14b 100644 --- a/env-example +++ b/env-example @@ -158,7 +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 +WORKSPACE_INSTALL_GIT_PROMPT=false ### PHP_FPM ###############################################