gradle / gradle-completion

Gradle tab completion for bash and zsh
MIT License
1.02k stars 133 forks source link

Replace deprecated egrep with grep -E #142

Closed tinder-ryantrontz closed 1 year ago

tinder-ryantrontz commented 1 year ago

This commit replaces the use of egrep with grep -E.

Motivation

When this project invokes egrep on a machine using GNU grep versions >= 3.8, a warning is printed to the console that egrep is obsolescent. This warning is interleaved with the in-progress terminal command, and creates an undesirable user experience. This is reproducible when a build is run (nearly-)immediately after the shell has initialized and the completion cache hasn't been populated.

Example output: This command intends to run a Gradle task on a subproject in the worker/ directory in a multi-project repo. When the user presses Tab after a few characters, this warning shows up and locks up the terminal for a few seconds.

❯ ./gradlew -p workegrep: warning: egrep is obsolescent; using ggrep -E
er/erating Gradle build script cache

Additional Background

The egrep and fgrep commands, which have been deprecated since release 2.5.3 (2007), now warn that they are obsolescent and should be replaced by grep -E and grep -F.

tinder-ryantrontz commented 1 year ago

Note: This is my first (of many I hope) contributions to the Gradle community. I tested these changes locally with bash and zsh, and the warning no longer shows up, and the completions still work correctly, both with project paths and directory paths. If there are any other testing steps or info needed on the PR, please feel free to let me know.

Thank you for reviewing this PR!

alllex commented 1 year ago

Thank you for your first and hopefully one of many contributions 😉

This looks good!