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

Filter by active dir #59

Open
Perilin opened this issue Dec 24, 2017 · 1 comment
Open

Filter by active dir #59

Perilin opened this issue Dec 24, 2017 · 1 comment
Labels
enhancement Feature requests or improvements good first issue

Comments

@Perilin
Copy link

Perilin commented Dec 24, 2017

Filtering by command is great, but how about also filtering by currently active directory?
I've quickly hammered something into place that works using preexec...

# Added to end of  ~/.bashrc

__peri_filter_preexec() { if [[ "${PWD}" =~ .*Private.* ]] ; then __BH_SAVE_COMMAND=''; fi }
if [ -f ~/.bashhub/deps/bash-preexec.sh ]; then source  ~/.bashhub/deps/bash-preexec.sh ; preexec_functions+=(__peri_filter_preexec); fi

Prevents saving any command while active in any path containing the word Private
But this feels a bit iffy, would prefer not to have to use internal bashhub variables, etc, etc

@rcaloras rcaloras added enhancement Feature requests or improvements good first issue labels Dec 24, 2017
@rcaloras
Copy link
Owner

@Perilin thanks for the feedback and example using preexec!

This would actually be a pretty straight forward change. I think this could be implemented via the config (i.e. ~/.bashhub/config) as a regex similar to the existing command filter. You could also check or edit it via the bashhub filter command.

Any interest in submitting a PR? You could template from how I built the command filter in a4a0c75ea04d160.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests or improvements good first issue
Projects
None yet
Development

No branches or pull requests

2 participants