-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
completion/bash-it: lint and simplify #2029
Conversation
43464e1
to
d3095da
Compare
@tsiflimagas, could you take a look at this one? I accidentally fell down the rabbit hole after you refactored this completion and...refactored it again! Pls forgive me! This version should, I hope, be shorter code and should support international characters (including spaces and unicode), and should use existing functions from |
8cdcca2
to
cadbd04
Compare
3a47c43
to
f3d5ec2
Compare
Haha😆 That's great actually! Your changes are very nice, it's neat how @(mini|simpli)fied the code looks now. |
@tsiflimagas, I find that the code in this repo is full of rampant layering violations, but it's slow going cleaning things up! My general idea is that the component functions (the ones that touch files, i.e., I'm definitely not a fan of running |
🙃 Test is failing because GitHub's OSX runner is so frakking slow!!! 😭 |
f3d5ec2
to
303cf91
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This allows for spaces and special characters in file names, i.e. internaltional/unicode words.
...to `_bash-it()`. The norm is for the completion function for, e.g., `teh_cmd`. to be named with the same name and a prepended underscore, i.e. `_teh_cmd`. This alsö reduces namespace confusion, which will be relevant in a future patch.
303cf91
to
2f4ed49
Compare
Now that #1934 is merged, I believe that this should no longer stumble through |
Description
shfmt
shellcheck
_bash-it-component-list-enabled()
and_bash-it-component-list-disabled()
instead of reinventing the wheel.read -ra
to populate$COMPREPLY
, instead of unquoted word separation._compreply_candidates()
to simplify the loop forread -ra
.Motivation and Context
After the recent performance upgrades for this completion, I took a look at what was bogging it down before and decided to lint the file. I then fell down the rabbit hole and accidentally refactored it again. I preserved the structure and speed, but deleted quite a lot by using existing functions as well as ensuring we handle spaces and International/unicode characters properly.
How Has This Been Tested?
Manual testing at the command line,
test/completion/bash-it.completion.bats
, and the full test suite.Types of changes
Checklist:
clean_files.txt
and formatted it usinglint_clean_files.sh
.