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
Shell completion #946
Shell completion #946
Conversation
Bug was: Account names with spaces were broken into single completion suggestions, not line by line.
Completion for Bash is finished, I think! I can only provide completion for Bash. Scripts for other Shells (e.g. Fish, zsh) are welcome. I'll add a section in the README on how to use this "framework". |
Nice @schoettl. I just added the (WIP) suffix to remind me not to merge, feel free to remove it now (I'd like to know if you have that access). Would anyone like to do a little testing before I merge this ? |
hledger-completion.bash does not depend on command-options because this phony target is so slow. Use make once and subsequently only make hledger-completion.bash
It seems to be convention to start the completion function name with an underscore. I also prepend an underscore to the global variable. (I still don't understand why env does not show this global variable defined in the hledger-completion.bash script.)
Another bugfix for filename completion. I think, now it's functioning really good! Some testers? ... before I remove the WIP in the title... I'm not completely satisfied with it because I'm not sure if I fully understand Bash's completion system ( |
I added completions for query filters like "status:" or "inacct:" in addition to account names. Filters are taken from http://hledger.org/doc/1.1/manual.html#queries |
Nice. Why version 1.1 ? You probably want to follow http://hledger.org/manual.html#queries Let me know when you feel ready to have this merged. |
b9f7d98
to
1472111
Compare
Oh, the search engine took me to the old doc. Fixed. I also added I'd like to wait a few more days before the merger. Maybe I come up with more ideas :) |
TODO for me: install current latest version (AUR, *-git?) of hledger and run make again to get latest option and command completions. |
Ready to merge. |
This creates the shell-completions/ subdirectory, which contains a README for getting started. So far so good. How can we make this more discoverable and get folks likely to use it, using it ? Where could we mention it in the docs ? |
Perhaps a new page in the Cookbook, & linked in the wiki sidebar ? |
And/or.. a new section in the hledger manual ? |
I'd rather try to get package maintainers to install it together with hledger. Then, people who use auto completion will quickly find out. (Do we have a changelog?) I'm not sure if it's worth a section in the A cookbook entry would be useful if the completion is not installed with the package manager. If it is installed automatically, I would just reference to the README to not duplicate content that is only relevant for developers. What do you think? |
I think it's hard/slow to get new users; I would advertise everywhere that makes sense. And I would guess many/most hledger users aren't installing via system package. For myself trying this out, I'd like to follow some kind of link from the docs accessible from http://hledger.org . But I'm going to merge the work so far, and we can follow up. Thanks for working on it! |
Related to #945
Comments?
Please don't merge yet, I want to enhance the completion behavior with
--files=
.