diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..370dd80 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,18 @@ +name: Build + +on: + push: + branches: + - '*' + pull_request: + branches: + - master + +jobs: + shellcheck: + name: ShellCheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Run ShellCheck ... + uses: ludeeus/action-shellcheck@master diff --git a/CHANGELOG.md b/CHANGELOG.md index 204c9ea..1577710 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ > Any trouble, please visit the [troubleshooting page](https://github.com/diogocavilha/fancy-git/blob/master/TROUBLESHOOTING.md) +## v7.1.6 + +- Fix code stye according to ShellCheck rules. +- Remove commands to enable/disable tag name. +- Fix minor bugs. + ## v7.1.5 - Update screenshots on readme file. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 219a490..693e0e3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,11 +13,11 @@ Please use [GitHub Issues](https://github.com/diogocavilha/fancy-git/issues) to Please follow these steps: 1. Give this project a star. :vulcan_salute: -2. **Fork** the project. -3. **Clone** the project to your own machine. +2. Fork the project. +3. Clone the project to your own machine. 4. Create a branch. (`git checkout -b your-branch-name` or `gcb your-branch-name`). - - Don't forget to change the `version.sh` file for creating the new version. - - Don't forget to update the `CHANGELOG.md` file by adding some topics containing briefs of the changes you did. As you can see, there are plenty of entries there, so it's quite simple to create yours by following some example. -6. **Commit** changes to the branch you've just created. -7. **Push** your work back up to your fork. -8. Submit a **Pull Request** and take a coffee (or even better, you could take a coffee before it). + - Don't forget to change the **version.sh** file for creating the new version. + - Don't forget to update the **CHANGELOG.md** file by adding some topics containing briefs of the changes you did. As you can see, there are plenty of entries there, so it's quite simple to create yours by following some example. +6. Commit changes to the branch you've just created. +7. Push your work back up to your fork. (`git push origin your-branch-name`). +8. Submit a Pull Request and take a coffee (or even better, you could take a coffee before it). diff --git a/README.md b/README.md index 2518db0..a61954a 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![All Contributors](https://img.shields.io/badge/all_contributors-13-orange.svg?style=flat-square)](#contributors-) +[![Build](https://github.com/diogocavilha/fancy-git/actions/workflows/main.yml/badge.svg)](https://github.com/diogocavilha/fancy-git/actions/workflows/main.yml) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![made-with-bash](https://img.shields.io/badge/Made%20with-Bash-1f425f.svg)](https://www.gnu.org/software/bash/) [![MIT Licence](https://badges.frapsoft.com/os/mit/mit.svg?v=103)](https://github.com/diogocavilha/fancy-git/blob/master/LICENSE) @@ -12,7 +13,7 @@ FancyGit is a tool which works for Linux and MAC OS, that changes the terminal prompt in order to show you a few cool git informations when you're working on a git repo. It'll always keep you informed about the current branch status. -:rocket: [Guidelines for contributing](https://github.com/diogocavilha/fancy-git/blob/master/CONTRIBUTING.md) | :monocle_face: [Changelog](https://github.com/diogocavilha/fancy-git/blob/master/CHANGELOG.md) | :hammer: [Troubleshooting](https://github.com/diogocavilha/fancy-git/blob/master/TROUBLESHOOTING.md) +:rocket: [Contributing](https://github.com/diogocavilha/fancy-git/blob/master/CONTRIBUTING.md) | :monocle_face: [Changelog](https://github.com/diogocavilha/fancy-git/blob/master/CHANGELOG.md) | :hammer: [Troubleshooting](https://github.com/diogocavilha/fancy-git/blob/master/TROUBLESHOOTING.md) # :cupid: Installing @@ -284,14 +285,6 @@ FANCYGIT_ICON_HAS_ADDED_FILES FANCYGIT_ICON_HAS_UNPUSHED_COMMITS ``` -# :pick: Troubleshooting - -[Troubleshooting page](https://github.com/diogocavilha/fancy-git/blob/master/TROUBLESHOOTING.md) - -# :rocket: Contributing - -[Guidelines for contributing](https://github.com/diogocavilha/fancy-git/blob/master/CONTRIBUTING.md#rocket-contributing-to-fancygit) - # Contributors ✨ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): diff --git a/TROUBLESHOOTING.md b/TROUBLESHOOTING.md index 37aa01a..13232fc 100644 --- a/TROUBLESHOOTING.md +++ b/TROUBLESHOOTING.md @@ -1,27 +1,27 @@ # :pick: Troubleshooting -- **Double line problem and general weird behavior** -**System:** Linux | MAC OS - [reported issue](https://github.com/diogocavilha/fancy-git/issues/63). +### :bug: Double line problem and general weird behavior +**System:** Linux/MAC OS - [reported issue](https://github.com/diogocavilha/fancy-git/issues/63). If you have a few more changes in your `.bashrc` file, be aware that `. ~/.fancy-git/prompt.sh` must be the last line of it. -- **Problems with Konsole Terminal** +### :bug: Problems with Konsole Terminal **System:** Linux (with KDE) - [reported issue](https://bugs.kde.org/show_bug.cgi?id=272443). -Maybe you could face an issue related to icons rendering when using `Konsole` on version `18.12.1`. -An idea here is to update the `Konsole` to its latest version. So the problem might be solved ;) +Maybe you could face an issue related to icons rendering when using **Konsole** on version **18.12.1**. +An idea here is to update the **Konsole** to its latest version. So the problem might be solved ;) -- **Problems with `grep` command** +### :bug: Problems with `grep` command **System:** MAC OS - [reported issue](https://github.com/diogocavilha/fancy-git/issues/47). As you can read there, the solution found is to `brew install grep` and adding `/usr/local/opt/grep/libexec/gnubin` to the PATH ahead of `/usr/bin`. -- **Problems with `sed` command** +### :bug: Problems with `sed` command **System:** MAC OS - [reported issue](https://github.com/diogocavilha/fancy-git/issues/47). You can follow the steps as you did for `grep`, but this time, installing `gnu-sed` by running `brew install gnu-sed`. -- **Problems upgrading from v6.0.5 to a newest version** +### :bug: Problems upgrading from v6.0.5 to a newest version If you've just upgraded it from v6.0.5 to a newest version, you might have seeing an error, because FancyGit can't find its configuration file. -You can fix that just by running `fancygit --config-reset`. It'll create a default configuration file and reset the FancyGit state. +You can fix that just by running `fancygit --reset`. It'll create a default configuration file and reset the FancyGit state. -- **Icons rendering** +### :bug: Icons rendering **System:** Windows (WSL) - [reported issue](https://github.com/diogocavilha/fancy-git/issues/70). If you use Windows terminal, under WSL system, Fancy Git will not render icons and symbols properly. In this case, you can use [this font](https://github.com/microsoft/cascadia-code). This might solve the problem. diff --git a/alias_functions/ga.sh b/alias_functions/ga.sh index c20e14d..8d74d1c 100644 --- a/alias_functions/ga.sh +++ b/alias_functions/ga.sh @@ -5,6 +5,6 @@ # # git add -git add $* && \ +git add "$*" && \ clear && \ git status diff --git a/alias_functions/gck.sh b/alias_functions/gck.sh index d6e98e1..17db5b5 100644 --- a/alias_functions/gck.sh +++ b/alias_functions/gck.sh @@ -5,6 +5,6 @@ # # git checkout -- -git checkout -- $* && \ +git checkout -- "$*" && \ clear && \ git status diff --git a/alias_functions/gckbt.sh b/alias_functions/gckbt.sh index c8d085c..6289761 100644 --- a/alias_functions/gckbt.sh +++ b/alias_functions/gckbt.sh @@ -6,4 +6,4 @@ # git checkout --track origin/ branch_name="$1" -git checkout --track origin/$branch_name +git checkout --track origin/"$branch_name" diff --git a/alias_functions/gd.sh b/alias_functions/gd.sh index db6f445..8116af6 100644 --- a/alias_functions/gd.sh +++ b/alias_functions/gd.sh @@ -20,7 +20,7 @@ fi git diff "$1" echo "" -read -p " Add this file to commit? [y/N]: " r +read -rp " Add this file to commit? [y/N]: " r if [ "$r" = "y" ]; then git add "$1" @@ -29,7 +29,7 @@ if [ "$r" = "y" ]; then fg_return fi -read -p " Rollback this file changes? [y/N]: " r +read -rp " Rollback this file changes? [y/N]: " r if [ "$r" = "y" ]; then git checkout "$1" diff --git a/alias_functions/gg.sh b/alias_functions/gg.sh index a18b555..98a5e59 100644 --- a/alias_functions/gg.sh +++ b/alias_functions/gg.sh @@ -12,4 +12,4 @@ msg="$1" git add --all && \ git commit -m "$msg" && \ -git push origin $branch_name +git push origin "$branch_name" diff --git a/alias_functions/glp.sh b/alias_functions/glp.sh index 7ae4101..0934009 100644 --- a/alias_functions/glp.sh +++ b/alias_functions/glp.sh @@ -7,4 +7,4 @@ logCmd="git log --date=short --pretty=format:'%C(bold yellow)%h%C(reset) %C(white)%ad %C(bold blue)(%ar)%C(reset) %C(bold green)%an %C(reset)%C(cyan)%s%C(reset)'" -eval $logCmd $* +eval "$logCmd $*" diff --git a/alias_functions/gpl.sh b/alias_functions/gpl.sh index 9a8d174..5ebecb5 100644 --- a/alias_functions/gpl.sh +++ b/alias_functions/gpl.sh @@ -5,6 +5,7 @@ # # git pull +# shellcheck source=/dev/null . ~/.fancy-git/random_messages.sh run() { diff --git a/alias_functions/gplo.sh b/alias_functions/gplo.sh index 332b53b..95ccc02 100644 --- a/alias_functions/gplo.sh +++ b/alias_functions/gplo.sh @@ -5,13 +5,14 @@ # # git pull origin +# shellcheck source=/dev/null . ~/.fancy-git/random_messages.sh run() { local branch_name branch_name="$1" - git pull origin $branch_name + git pull origin "$branch_name" _fancygit_after_pulling_random_message } diff --git a/alias_functions/gplob.sh b/alias_functions/gplob.sh index e5450f4..ef788f9 100644 --- a/alias_functions/gplob.sh +++ b/alias_functions/gplob.sh @@ -5,13 +5,14 @@ # # git pull origin +# shellcheck source=/dev/null . ~/.fancy-git/random_messages.sh run() { local branch_name branch_name=$(git branch | grep -oP '(?<=\* ).*') - git pull origin $branch_name + git pull origin "$branch_name" _fancygit_after_pulling_random_message } diff --git a/alias_functions/gpsob.sh b/alias_functions/gpsob.sh index 33485a3..2ef397f 100644 --- a/alias_functions/gpsob.sh +++ b/alias_functions/gpsob.sh @@ -7,4 +7,4 @@ branch_name=$(git branch | grep -oP '(?<=\* ).*') -git push origin $branch_name +git push origin "$branch_name" diff --git a/alias_functions/grb.sh b/alias_functions/grb.sh index d6284e9..b77d311 100644 --- a/alias_functions/grb.sh +++ b/alias_functions/grb.sh @@ -9,4 +9,4 @@ new_branch_name="$1" -git branch -m $new_branch_name +git branch -m "$new_branch_name" diff --git a/alias_functions/grba.sh b/alias_functions/grba.sh index eae83ad..0ae1464 100644 --- a/alias_functions/grba.sh +++ b/alias_functions/grba.sh @@ -14,6 +14,6 @@ new_branch_name="$1" old_branch_name=$(git branch | grep -oP '(?<=\* ).*') -git branch -m $new_branch_name -git push origin :$old_branch_name -git push origin $new_branch_name +git branch -m "$new_branch_name" +git push origin :"$old_branch_name" +git push origin "$new_branch_name" diff --git a/alias_functions/gsta.sh b/alias_functions/gsta.sh index 5a30223..f0b2fc2 100644 --- a/alias_functions/gsta.sh +++ b/alias_functions/gsta.sh @@ -6,4 +6,4 @@ # git stash apply stash@{} stash_id="$1" -git stash apply stash@{$stash_id} +git stash apply "stash@{$stash_id}" diff --git a/alias_functions/gstd.sh b/alias_functions/gstd.sh index 5813f56..f43d3b8 100644 --- a/alias_functions/gstd.sh +++ b/alias_functions/gstd.sh @@ -6,4 +6,4 @@ # git stash drop stash@{} stash_id="$1" -git stash drop stash@{$stash_id} +git stash drop "stash@{$stash_id}" diff --git a/alias_functions/gstw.sh b/alias_functions/gstw.sh index a603a72..0c6a545 100644 --- a/alias_functions/gstw.sh +++ b/alias_functions/gstw.sh @@ -6,4 +6,4 @@ # git stash show stash@{} stash_id="$1" -git stash show stash@{$stash_id} +git stash show "stash@{$stash_id}" diff --git a/alias_functions/pve.sh b/alias_functions/pve.sh index 0085d5d..dc792f2 100644 --- a/alias_functions/pve.sh +++ b/alias_functions/pve.sh @@ -7,8 +7,8 @@ venv_name="none" -if ! [ -z ${VIRTUAL_ENV} ]; then - venv_name="`basename \"$VIRTUAL_ENV\"`" +if [[ -n ${VIRTUAL_ENV} ]]; then + venv_name=$(basename "$VIRTUAL_ENV") fi echo "" diff --git a/commands-handler.sh b/commands-handler.sh index f8a7946..508b7ec 100755 --- a/commands-handler.sh +++ b/commands-handler.sh @@ -5,6 +5,7 @@ # # Commands manager. +# shellcheck source=/dev/null . ~/.fancy-git/modules/settings-manager.sh . ~/.fancy-git/modules/git-manager.sh . ~/.fancy-git/modules/update-manager.sh @@ -38,7 +39,7 @@ case "$1" in "--enable-rich-notification") fancygit_config_save "show_rich_notification" "true";; "--disable-rich-notification") fancygit_config_save "show_rich_notification" "false";; - # Set Name and Host + # Set Name and Host. "--set-user-name") fancygit_config_save "user_name" "$2";; "--unset-user-name") fancygit_config_save "user_name" "";; "--set-host-name") fancygit_config_save "host_name" "$2";; @@ -95,6 +96,8 @@ case "$1" in "dark") fancygit_app_command_deprecation_warning "--color-scheme-batman";; "dark-col") fancygit_app_command_deprecation_warning "--color-scheme-robin";; "light") fancygit_app_command_deprecation_warning "--color-scheme-light";; + + # Default. "") fancygit_app_command_return;; *) fancygit_app_command_not_found "$1";; esac diff --git a/fancygit-completion b/fancygit-completion index 1c4b684..843ff3a 100644 --- a/fancygit-completion +++ b/fancygit-completion @@ -25,8 +25,6 @@ _fancygit() { --disable-double-line \ --enable-rich-notification \ --disable-rich-notification \ - --enable-tag-name \ - --disable-tag-name \ --set-user-name \ --unset-user-name \ --set-host-name \ diff --git a/help.sh b/help.sh index 1b3ce93..e6ddc5a 100644 --- a/help.sh +++ b/help.sh @@ -33,8 +33,6 @@ FEATURE SWITCHER COMMANDS: fancygit --disable-double-line Show a single line prompt. fancygit --enable-rich-notification Show notification area with icons. fancygit --disable-rich-notification Show notification area with simple symbols. - fancygit --enable-tag-name Show the current tag name. - fancygit --disable-tag-name Hide the current tag name. THEME COMMANDS: fancygit --theme-default Change prompt to the default theme. diff --git a/images/default_001.png b/images/default_001.png index 109a130..4d0fa7c 100644 Binary files a/images/default_001.png and b/images/default_001.png differ diff --git a/images/screenshots/separators.png b/images/screenshots/separators.png deleted file mode 100644 index 451a5ce..0000000 Binary files a/images/screenshots/separators.png and /dev/null differ diff --git a/images/screenshots/theme-default-double-line.png b/images/screenshots/theme-default-double-line.png deleted file mode 100644 index 507a444..0000000 Binary files a/images/screenshots/theme-default-double-line.png and /dev/null differ diff --git a/install.sh b/install.sh index 58f7b47..8f2b51b 100755 --- a/install.sh +++ b/install.sh @@ -9,7 +9,7 @@ FANCYGIT_RUNNING_OS=$(uname) FANCYGIT_GIT_PATH=$(whereis git | cut -d ":" -f 2) errcho() { - >&2 echo $@; + >&2 echo "$@"; } if [ "" = "$FANCYGIT_GIT_PATH" ]; then diff --git a/modules/app-manager.sh b/modules/app-manager.sh index 85ef096..0f97323 100755 --- a/modules/app-manager.sh +++ b/modules/app-manager.sh @@ -22,7 +22,7 @@ fancygit_app_command_show_version() { # ---------------------------------------------------------------------------------------------------------------------- # Show default error message when a command is not found. -# +# # param string $1 Command. # ---------------------------------------------------------------------------------------------------------------------- fancygit_app_command_not_found() { @@ -93,7 +93,7 @@ fancygit_show_color_schemes() { printf "\nAll available color schemes:\n\n" tput sgr0 - printf "%s\n" $(ls ${color_schemes_path}/* | sed "s,${color_schemes_path}/.*_,--color-scheme-,") + printf "%s\n" "$(find "${color_schemes_path}" | sed s,"${color_schemes_path}/.*_",--color-scheme-, | sed '1d')" echo "" return fi @@ -102,10 +102,10 @@ fancygit_show_color_schemes() { tput bold tput setaf 2 - printf "\nAvailable color schemes for current theme (--theme-${current_theme}):\n\n" + printf "\n%s\n\n" "Available color schemes for current theme (--theme-${current_theme}):" tput sgr0 - printf "%s\n" $(ls ${color_schemes_path}/${current_theme}_* | sed "s,${color_schemes_path}/${current_theme}_,--color-scheme-,") + printf "%s\n" "$(find "${color_schemes_path}/${current_theme}"_* | sed "s,${color_schemes_path}/${current_theme}_,--color-scheme-,")" echo "" } @@ -120,6 +120,6 @@ fancygit_show_themes() { printf "\nAll available themes:\n\n" tput sgr0 - printf "%s\n" $(ls ${themes_path}/* | sed "s,${themes_path}/*,--theme-," | sed 's/.sh//') + printf "%s\n" "$(find "${themes_path}"/* | sed "s,${themes_path}/*,--theme-," | sed 's/.sh//')" echo "" } \ No newline at end of file diff --git a/modules/git-manager.sh b/modules/git-manager.sh index e52de9f..40ec986 100644 --- a/modules/git-manager.sh +++ b/modules/git-manager.sh @@ -122,7 +122,7 @@ fancygit_git_get_branch() { # ---------------------------------------------------------------------------------------------------------------------- fancygit_git_get_tag() { local tag - + tag=$(git describe --tags --exact-match 2> /dev/null) if [ "" != "$tag" ] @@ -158,7 +158,7 @@ fancygit_git_get_changed_files() { __fancygit_git_get_remote_branch() { local branch_name - branch_name=$(git rev-parse --abbrev-ref --symbolic-full-name @{u} 2> /dev/null | cut -d"/" -f1) + branch_name=$(git rev-parse --abbrev-ref --symbolic-full-name "@{u}" 2> /dev/null | cut -d"/" -f1) branch_name=${branch_name:-origin} echo "$branch_name" } @@ -195,11 +195,11 @@ git config --global color.status.untracked \"cyan\" # Apply the suggested global git config. # ---------------------------------------------------------------------------------------------------------------------- fancygit_git_suggested_git_config_apply() { - `git config --global color.ui true` - `git config --global color.diff.meta "yellow bold"` - `git config --global color.diff.old "red bold"` - `git config --global color.diff.new "green bold"` - `git config --global color.status.added "green bold"` - `git config --global color.status.changed "yellow"` - `git config --global color.status.untracked "cyan"` + eval git config --global color.ui true + eval git config --global color.diff.meta "yellow bold" + eval git config --global color.diff.old "red bold" + eval git config --global color.diff.new "green bold" + eval git config --global color.status.added "green bold" + eval git config --global color.status.changed "yellow" + eval git config --global color.status.untracked "cyan" } \ No newline at end of file diff --git a/modules/update-manager.sh b/modules/update-manager.sh index 246ceab..9a44c32 100644 --- a/modules/update-manager.sh +++ b/modules/update-manager.sh @@ -71,14 +71,14 @@ __fancygit_update_checker() { local current_version local new_version - cd ~/.fancy-git + cd ~/.fancy-git || return current_version=$(git tag | tail -1) git fetch -t 2> /dev/null new_version=$(git tag | tail -1) - current_version_filter_number=$(echo "$current_version" | sed 's/[vV\.]//g') - new_version_filter_number=$(echo "$new_version" | sed 's/[vV\.]//g') + current_version_filter_number=${current_version//[vV\.]/} + new_version_filter_number=${new_version//[vV\.]/} if [[ "$current_version_filter_number" -lt "$new_version_filter_number" ]] then @@ -170,7 +170,7 @@ __fancygit_create_app_config() { # Auxiliar function to help on version compatibility. # ---------------------------------------------------------------------------------------------------------------------- __fancygit_copy_style_from_mode_file_to_app_config() { - if [ -f ~/.fancy-git/mode -a -f ~/.fancy-git/app_config ] + if [ -f ~/.fancy-git/mode ] && [ -f ~/.fancy-git/app_config ] then local style style=$(cat ~/.fancy-git/mode) diff --git a/prompt.sh b/prompt.sh index c6fcf55..f758508 100644 --- a/prompt.sh +++ b/prompt.sh @@ -5,6 +5,7 @@ # # Changes de prompt by loading the style configured in ~/.fancygit/app_config file. +# shellcheck source=/dev/null . "$HOME/.fancy-git/fancygit-completion" . "$HOME/.fancy-git/aliases" . "$HOME/.fancy-git/version.sh" diff --git a/theme-functions.sh b/theme-functions.sh index 7d6a90b..3568401 100644 --- a/theme-functions.sh +++ b/theme-functions.sh @@ -64,7 +64,7 @@ __fancygit_get_rich_notification_area() { venv=$(__fancygit_get_venv_icon) notification_area="${venv}${icon_git_stash}${icon_untracked_files}${icon_changed_files}${icon_added_files}${icon_unpushed_commits}" - echo "$notification_area " + echo "${notification_area//[[:space:]]*$/}" } # ---------------------------------------------------------------------------------------------------------------------- @@ -136,7 +136,8 @@ __fancygit_get_poor_notification_area() { then # Trim notification_area content notification_area=$(echo "$notification_area" | sed -e 's/[[:space:]]*$//' | sed -e 's/^[[:space:]]*//') - echo " [ $notification_area ] " + + echo "${notification_area//[[:space:]]*$/}" return fi @@ -151,7 +152,7 @@ __fancygit_get_venv_icon() { icon_venv=" " - if ! [ -z $VIRTUAL_ENV ] || ([ "$CONDA_DEFAULT_ENV" != "base" ] && ! [ -z $CONDA_DEFAULT_ENV ]) + if [[ -n $VIRTUAL_ENV ]] || [ "$CONDA_DEFAULT_ENV" != "base" ] && [[ -n $CONDA_DEFAULT_ENV ]] then echo "$icon_venv" return @@ -164,15 +165,15 @@ __fancygit_get_venv_icon() { # Return the virtual environment name if it exists. # ---------------------------------------------------------------------------------------------------------------------- fancygit_theme_get_venv_name() { - if ! [ -z ${VIRTUAL_ENV} ] + if [[ -n ${VIRTUAL_ENV} ]] then - echo "$(basename ${VIRTUAL_ENV})" + printf "%s" "$(basename "${VIRTUAL_ENV}")" return fi - if ([ "$CONDA_DEFAULT_ENV" != "base" ] && ! [ -z ${CONDA_DEFAULT_ENV} ]) + if [ "$CONDA_DEFAULT_ENV" != "base" ] && [[ -n ${CONDA_DEFAULT_ENV} ]] then - echo "$(basename ${CONDA_DEFAULT_ENV})" + printf "%s" "$(basename "${CONDA_DEFAULT_ENV}")" return fi @@ -218,7 +219,7 @@ fancygit_theme_get_time() { fancygit_theme_get_double_line() { if fancygit_config_is "double_line" "true" then - echo "\n$(fancygit_config_get "ps2" "➜")" + printf "\n%s" "\n$(fancygit_config_get "ps2" "➜")" fi echo "" @@ -246,7 +247,7 @@ fancygit_theme_color_scheme_set() { then tput bold tput setaf 3 - printf "\n> Color scheme (--color-scheme-${color_scheme}) is not supported by current theme (--theme-${current_theme}).\n" + printf "\n%s\n" "> Color scheme (--color-scheme-${color_scheme}) is not supported by current theme (--theme-${current_theme})." printf "> Type \"fancygit --show-color-schemes\" to check available color schemes for current theme.\n\n" tput sgr0 return @@ -274,7 +275,7 @@ fancygit_theme_set() { then tput bold tput setaf 3 - printf "\n> You're already using --theme-${param_theme_name}\n\n" + printf "\n%s\n\n" "> You're already using --theme-${param_theme_name}" tput sgr0 return fi diff --git a/themes/default.sh b/themes/default.sh index eca806d..32cb6ca 100644 --- a/themes/default.sh +++ b/themes/default.sh @@ -16,6 +16,7 @@ fancygit_theme_builder() { color_scheme=$(fancygit_config_get "color_scheme" "default_default") # Load the color scheme. + # shellcheck source=/dev/null . "${HOME}/.fancy-git/color_schemes/${color_scheme}" # !! WARNING !! @@ -73,6 +74,7 @@ fancygit_theme_builder() { local prompt_env local prompt_path local prompt_double_line + local notification_area local is_rich_notification local time_raw @@ -137,7 +139,8 @@ fancygit_theme_builder() { branch_end="${bg_none}${bold_none}${branch_color_staged_files_tag}${separator}${none}" fi - prompt_path="${path_git}$(fancygit_get_notification_area "$is_rich_notification")${prompt_path} ${path_end}" + notification_area=$(fancygit_get_notification_area "$is_rich_notification") + prompt_path="${path_git}${notification_area} ${prompt_path} ${path_end}" prompt_branch="${branch} $(fancygit_git_get_branch_icon "${branch_name}") ${branch_name} ${branch_end}" PS1="${prompt_time}${prompt_user}${prompt_symbol}${prompt_path}${prompt_branch}${prompt_double_line} " } diff --git a/themes/human.sh b/themes/human.sh index 1d31753..ac7ef1b 100644 --- a/themes/human.sh +++ b/themes/human.sh @@ -16,6 +16,7 @@ fancygit_theme_builder() { color_scheme=$(fancygit_config_get "color_scheme" "human_human") # Load the color scheme. + # shellcheck source=/dev/null . "${HOME}/.fancy-git/color_schemes/${color_scheme}" # !! WARNING !! @@ -115,7 +116,7 @@ fancygit_theme_builder() { then prompt_path="${path_git}${path_sign}${path_end}" prompt_branch="${branch}${branch_name}${branch_end}" - PS1="${prompt_time}${prompt_user_at_host}${prompt_path}${venv_name} on ${prompt_branch}$(fancygit_get_notification_area "$is_rich_notification")" + PS1="${prompt_time}${prompt_user_at_host}${prompt_path}${venv_name} on ${prompt_branch} $(fancygit_get_notification_area "$is_rich_notification") " PS1="${PS1}${prompt_symbol}${is_double_line} " return fi diff --git a/themes/simple.sh b/themes/simple.sh index f90f031..fb10158 100644 --- a/themes/simple.sh +++ b/themes/simple.sh @@ -16,6 +16,7 @@ fancygit_theme_builder() { color_scheme=$(fancygit_config_get "color_scheme" "simple_simple") # Load the color scheme. + # shellcheck source=/dev/null . "${HOME}/.fancy-git/color_schemes/${color_scheme}" # !! WARNING !! @@ -79,14 +80,10 @@ __fancygit_theme_get_branch_area() { branch_name=$(fancygit_git_get_branch) branch_status=$(fancygit_get_notification_area "$is_rich_notification") - branch_status=$(echo "$branch_status" | sed -e 's/[[:space:]]*$//') if [ "$branch_status" != "" ] then - if [ "true" = "$is_rich_notification" ] - then - branch_status=" [ $(echo "$branch_status" | sed -e 's/^[[:space:]]*//') ]" - fi + branch_status=" [ ${branch_status//^[[:space:]]*/} ]" if [ "HEAD" = "$branch_name" ] then diff --git a/version.sh b/version.sh index 114bc81..97e82ea 100644 --- a/version.sh +++ b/version.sh @@ -3,5 +3,4 @@ # Author: Diogo Alexsander Cavilha # Date: 11.17.2017 -FANCYGIT_VERSION="7.1.5" -export FANCYGIT_VERSION +export FANCYGIT_VERSION="7.1.6"