You are not logged in.
Hey guys,
I've been working on a bash-completion for a dot file management script I've been polishing off.
I'd like to do completion from a specific list of file paths like they were real paths, but can't seem to figure out how.
Here's the StackOverflow question I asked a few days ago
Any ideas?
Last edited by EvanPurkhiser (2013-11-14 09:41:54)
Offline
Have you looked at how e.g. the completion for subversion works with SVN_BASH_COMPL_EXT is set to allow the options described as "expensive"? If you have svn installed, /usr/share/bash-completion/completions/svn* document the different settings etc. I don't know if this will help at all but I guess it must get stuff to be seen as paths, if you see what I mean?
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Hey thanks cfr.
I took a look at how SVN completes things like `svn status` and the such when `SVN_BASH_COMPL_EXT` is set to one of the expensive options.
It's very close to what I want.
If I do a svn status and complete the file paths it looks pretty good (aside from listing folders twice)
$ svn status [tab][tab]
test/ test second_dir/ second_dir
However..
$ svn status test/[tab][tab]
test/somefile test/otherfile
If this was normal path completion it would look more like
$ svn status test/[tab][tab]
somefile otherfile
I have a few ideas such as adding a / to COMP_WORDBREAKS, but that's tricky because you need to reset it.
If anyone knows of any other utilities that come with custom path completion please let me know!
Offline
Hmm... Yes. I see what you mean. For svn, that's actually pretty useful but I can see it would not always be so.
EDIT: Maybe one of the other version control systems does it in a way which would match what you want? I was going to look at the completion for git but I don't understand git well enough so I looked at subversion which I use all the time (at least try to!). Solved a query I had about getting better completions for svn, anyway. (I realise that doesn't help you but it made me happy. Obviously, I'd be happier if it provided a solution for you as well.)
Last edited by cfr (2013-11-09 02:51:19)
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Alright! I found a utility with bash-completions that does what I would like! It's called pass.
Here's the relevant file that handles the file completion. I haven't looked through it enough but I think this should solve my problem! I'll update the thread and mark it as solved (as well as answer my SO question) if this solves it.
Edit: Looking a little more into this maybe this won't solve it . This only works for existing file paths.
Last edited by EvanPurkhiser (2013-11-12 03:55:21)
Offline
I've solved it! Check out my answer on the stack overflow question.
Offline
Llongyfarchiadau!
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline