-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
Run the bash_completion project #208
Comments
7521118 fixes some issues with |
I just made a quick skim through the patches in
|
Part of the goal of OSH is also to be saner, so if there is a trivial patch like I think it's probably time to contact the maintainers of bash-completion and see how amenable they are to patches that will work in both bash and OSH. This will obviously be a lot more convincing if we can run the whole project :) Whether we have to maintain a fork will probably influence some decisions. But since all the patches are one-liners, I think it will be easy to maintain a fork if we have to (hopefully not for too long).
|
Yup, looks like it. Hopefully exactly the same logic, so we can largely share the implementation.
Reasonable. It's certainly cheap to stick to that position here, since this script already needs some other patches -- |
Update: Much more of this runs, and everything I tested in git-completion.bash also runs. Big takeaway:
In other words, OSH has a significantly different architecture than bash, because it actually uses its own parser to complete the language. There are really two separate problems:
Bash conflates these two things, which makes it essentially impossible to do a correct job, but OSH doesn't. There are still bugs:
Big commits: @gnprice Thanks for helping out with this! When I checked the status of the code a couple weeks ago, I realized the indirect array references you implemented pushed it over the edge to really running. It seems like that was one of the last big blockers, and most other things are polish. I gave you a shout-out here: http://www.oilshell.org/blog/2018/12/16.html#toc_4 Although this "breakthrough" with |
It now does word evaluation and splitting. - Added a spec test for a related case where where complete/compgen -F swallows errors. - Add test cases for runtime errors in the interactive 'complete' case. Addresses issue #208.
bash-completion uses this to parse options. Addresses issue #208. Also, add test for IFS character escaping in compgen/complete -W.
This was necessary because the base options can CHANGE when the "124 protocol" is invoked. This manifested as a lack of trailing slash the FIRST time we completed '.' using bash-completion's _minimal function. This bug is now fixed. Addresses issue #208.
- The basename() test in GetSpecForFirst() was broken, which caused an infinite loop when running ~/.local/bin/mypy. Fixed with unit test. - The 124 protocol now tests if the completion spec was changed before retrying. This prevents a function that simply does 'return 124' from entering an infinite loop. The unit tests have coverage for this case via 'return-124.bash'. Addresses issue #208.
I've seen it used a decent amount of times, e.g., https://github.com/dylanaraps/neofetch, https://github.com/dylanaraps/birch, my own https://github.com/Crestwave/brainbash, etc. |
Yeah I suspect in the long term we may need We have a partial implementation of Another approach to consider is to simply copy some C code that implements it. Every shell has a pretty compatible implementation, and it's self-contained. The |
This is done (and Some patches to the bash-completion project are necessary, but that's intentional... I removed the bash parser in bash :-/ |
See also #175 (Run git-completion.bash)
Things that don't work:
printf -v var %q foo
-- should be changed tovar=${foo@Q}
${!x}
wherex=a[i]
. PR by Greg Price${!x#pattern}
-- var ref then prefix/suffix op. Reported by Greg Price.local "$2"
work and revert theeval
patches (I think). This is related to static vs. dynamic parsing, mentioned in cleanup: rationalize ${a[x]} and $(( a[x] )) #207.export
andlocal/readonly/declare
that I would like to resolve. Right nowexport
is only dynamically parsed, butlocal/readonly/declare
are statically parsed.TODO: What else?
The text was updated successfully, but these errors were encountered: