Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib/utilities: minor improvements #1973

Merged
merged 5 commits into from
Oct 18, 2021
Merged

Conversation

gaelicWizard
Copy link
Contributor

Please review commit notes as appropriate.

Description

Some minor improvements to lib/utilities:

  • alternative, simplified grep helper
  • simplification of _bash-it-array-dedup()
  • use $XDG_CACHE_HOME for cache file

Motivation and Context

Just cleaning up

How Has This Been Tested?

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the code style of this project.
  • If my change requires a change to the documentation, I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • If I have added a new file, I also added it to clean_files.txt and formatted it using lint_clean_files.sh.
  • I have added tests to cover my changes, and all the new and existing tests pass.

@gaelicWizard gaelicWizard force-pushed the utilities branch 3 times, most recently from 8718812 to 2d97377 Compare October 13, 2021 16:08
alsö fix usage example of `_bash-it-array-contains-element()`
No need to `rm` when we overwrite the file the line after next. Alsö, use `>|` in case the user sets `noclobber`; we do expressly intend to overwrite the file in this case.
Copy link
Member

@NoahGorny NoahGorny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @gaelicWizard
Can you please remove the direct mention of my username in 1601ea7?
Just remove the "@" so it wont spam me every time somebody will fork/rebase

@gaelicWizard
Copy link
Contributor Author

gaelicWizard commented Oct 18, 2021

Just remove the "@" so it wont spam me every time somebody will fork/rebase

Ummm....oops!

Fixed! Alsö, fixed a typo in another commit note.

Use $XDG_CACHE_HOME environment constant instead of placing a tmp/cache folder inside the bash-it data repo. If not defined, fall back to current behavior.

This resolves Bash-it#1904.
Doesn't show up on my shellcheck 0.7.2, but does for NoahGorny!
The existing function `_bash-it-grep()` is weird. New function `_bash-it-egrep()` just does the thing without requiring two subshells and manual invocation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants