fancy-git icon indicating copy to clipboard operation
fancy-git copied to clipboard

Grep command unstable in the scripts

Open vijaypolsani opened this issue 4 years ago • 6 comments

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.

vijaypolsani avatar Sep 21 '21 01:09 vijaypolsani

Hi, @vijaypolsani

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

diogocavilha avatar Sep 21 '21 13:09 diogocavilha

Hello, @vijaypolsani.

I hope you're doing good.

Does that problem you mentioned still remains?

diogocavilha avatar Feb 21 '22 12:02 diogocavilha

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")

bobsc avatar Apr 12 '22 20:04 bobsc

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

alexZaicev avatar Jun 22 '22 15:06 alexZaicev

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

ugmurthy avatar Dec 07 '22 07:12 ugmurthy

Having the same issue on MacOS 14.2

monicaluodialpad avatar Jan 29 '24 00:01 monicaluodialpad