This beast will be useful to those who do not use GUI utilities when working with git, mercurial, etc., and feel comfortable working with them from the console.
vcprompt.com is a python script that will display basic information on the VCS version in the current directory, if any. Like the name of the VCS, the current branch, were there any changes from the last commit and a few more parameters that can be set in the output format.
The site has instructions for adding output information in the bash prompt.
Alternatively, in bash, you can still use such a thing as PROMPT_COMMAND, the value of this variable is executed each time before displaying the prompt string.
Example:
')
print_before_the_prompt () { printf "\n%s\e[0;36m%s\e[0m\n" "$PWD" "$(vcprompt --format '[%s:%b%m%u]')" } PROMPT_COMMAND=print_before_the_prompt export CLICOLOR=1 export LSCOLORS=ExFxCxDxBxegedabagacad export PS1="\[\033[0;31m\]⇢\[\033[0m\] "
As a result, we obtain approximately the following result.
PS so that the output of the VCS version is from a new line, and not into a single line with PWD. On the 210th line in the vcprompt file, it is necessary to perform the hardest patching code
return output
replaced by
return "\n" + output