diogocavilha / fancy-git

That's a terminal prompt changer that shows a few cool git informations about your repository state. You can choose among different styles and enjoy all the aliases it provides you. Feel free for contributing, pull requests and issues are always welcome! ;)
GNU General Public License v2.0
479 stars 63 forks source link

Grep command unstable in the scripts #100

Open vijaypolsani opened 3 years ago

vijaypolsani commented 3 years ago

Scripts seems to be using a wrong grep command and every operation of command line syntax. Operating on: Terminal MAC OS BigSur 11.6 StopGap Fix: Move to the older TAG 64.1 of the codebase HEAD detached at 590d849

usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]] [-e pattern] [-f file] [--binary-files=value] [--color=when] [--context[=num]] [--directories=action] [--label] [--line-buffered] [--null] [pattern] [file ...] usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]] [-e pattern] [-f file] [--binary-files=value] [--color=when] [--context[=num]] [--directories=action] [--label] [--line-buffered] [--null] [pattern] [file ...] usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]] [-e pattern] [-f file] [--binary-files=value] [--color=when] [--context[=num]] [--directories=action] [--label] [--line-buffered] [--null] [pattern] [file ...] usage: grep [-abcDEFGHhIiJLlmnOoqRSsUVvwxZ] [-A num] [-B num] [-C[num]] [-e pattern] [-f file] [--binary-files=value] [--color=when] [--context[=num]] [--directories=action] [--label] [--line-buffered] [--null] [pattern] [file ...]

The default interactive shell is now zsh. To update your account to use zsh, please run chsh -s /bin/zsh. For more details, please visit https://support.apple.com/kb/HT208050.

diogocavilha commented 3 years ago

Hi, @vijaypolsani

Does it happen when you type some specific command? Could you please share a screenshot of it?

diogocavilha commented 2 years ago

Hello, @vijaypolsani.

I hope you're doing good.

Does that problem you mentioned still remains?

bobsc commented 2 years ago

This happens because the grep command on MacOSX does not support -P (perl-regex) . I fixed it on mine by using a different method to get the information. For example, in settings-manager.sh:

current_setting_value=$(grep -oP "(?<=$param_setting_name:).*" < "$FANCYGIT_CONFIG_FILE")

current_setting_value=$(git config --list | grep $param_setting_name: "$FANCYGIT_CONFIG_FILE"| cut -d ":" -f 2)

Here are all the offending lines: .fancy-git/alias_functions/guser.sh:9:# guser=$(git config --list | grep -oP '(?<=user.name=).') .fancy-git/alias_functions/guser.sh:10:# gemail=$(git config --list | grep -oP '(?<=user.email=).') .fancy-git/alias_functions/gpsob.sh:8:branch_name=$(git branch | grep -oP '(?<=* ).') .fancy-git/alias_functions/gplob.sh:13: branch_name=$(git branch | grep -oP '(?<=* ).') .fancy-git/alias_functions/grba.sh:15:old_branch_name=$(git branch | grep -oP '(?<=* ).') .fancy-git/alias_functions/gg.sh:10:#branch_name=$(git branch | grep -oP '(?<=* ).') .fancy-git/modules/settings-manager.sh:41:# current_setting_value=$(grep -oP "(?<=$param_setting_name:).*" < "$FANCYGIT_CONFIG_FILE")

alexZaicev commented 2 years ago

Same issue is present when I tried to install on MacOSX 😢

ugmurthy commented 1 year ago

I am having the same issue on MacOSX and have decided to uninstall it. However it works well for me on my Linux laptop as well as raspberry pi

Hope there is a fix for Mac

monicaluodialpad commented 9 months ago

Having the same issue on MacOS 14.2