bash completion fix
Fix bash completion of "git annex" to propertly handle files with spaces and other problem characters. (Completion of "git-annex" already did.) This commit was sponsored by Jake Vosloo on Patreon.
This commit is contained in:
parent
d01c7c173c
commit
5ce078da92
4 changed files with 41 additions and 3 deletions
|
@ -51,3 +51,4 @@ However, it doesn't correctly handle escape characters. Typically, a filename co
|
|||
|
||||
Many times over! I use git-annex to manage my hundreds of pdfs, images, video files etc! It essentially enables *exactly* the work flow I like, since I live in the command line and appreciate fine-grained control over my tools. So, yes, thank you very much for this excellent too!
|
||||
|
||||
> [[fixed|done]] --[[Joey]]
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 1"""
|
||||
date="2018-11-12T16:13:26Z"
|
||||
content="""
|
||||
I see this too. Note that it only affects tab
|
||||
completing "git annex"; tab completing "git-annex"
|
||||
works correctly for filenames with spaces and AFAICS
|
||||
other problem characters.
|
||||
|
||||
It used to be that git-annex's tab completion for "git annex" was only used
|
||||
after the user tab completed "git-annex" which loaded the function.
|
||||
That has changed; git now loads the git-annex completion. Which is good;
|
||||
I asked the git devs a long time ago to add that. But the change means this
|
||||
problem is more visible. I don't think the problem is new though.
|
||||
|
||||
[[!commit 07c108e70e2df354d1478cbbec3630d2409d9d32]]
|
||||
dealt with the same problem affecting "git-annex" tab completion.
|
||||
The underlying problem is a bug in optparse-applicative, which
|
||||
completes filenames without escaping them.
|
||||
So that commit made the "git-annex" completion use "-o bashdefault -o default"
|
||||
which bypasses the optparse-applicative completion for filenames and lets
|
||||
bash handle them. It didn't seem to deal with "git annex" completion.
|
||||
|
||||
I see that git uses `__gitcomp_file_direct` when using eg `git ls-files`
|
||||
to list filenames. It seems that "compopt -o filenames" along with
|
||||
IFS=newline fixes it. I'll put the same approach into the git-annex script.
|
||||
"""]]
|
Loading…
Add table
Add a link
Reference in a new issue