As a follow up to #214 it would be great to improve the Bash completion to support completion of Manta paths, e.g. mls /trent.mick/stor/a<TAB>.
I started looking at doing this when working on #214 but ran into a road block that'll make this a lot more difficult.
First, the start at this: https://gist.github.com/trentm/401182d1cab8e9d9e1f029bd068ee462 is a start at content to be used for 'specExtra' content to the 'bashCompletion' dashdash and cmdln methods. This is a first stab at handling the 'mpath' completion type. Afterwards support for the 'mdir' type should be done.
The real problem tho is that the above tab completion sucks unless one uses complete -o nospace to set it up. From man bash:
-o comp-option
The comp-option controls several aspects of the compspec's behav-
ior beyond the simple generation of completions. comp-option may
be one of:
...
default Use readline's default filename completion if the compspec
generates no matches.
...
nospace Tell readline not to append a space (the default) to words
completed at the end of the line.
Without 'nospace' the completion of a dir will append a space, which means to descend into a dir you need to backspace after a completing TAB. That's just painful.
However, currently the dashdash completion stuff is hardwired to use 'complete -o default' and a number of its handling decisions assume 'complete -o default'. Just changing to 'complete -o nospace' would: (a) make completing on options quite different (no space after completing one); and (b) would lose local file/dir completion that you get from '-o default'.
The right answer (or an answer) would be to make dashdash/cmdln completion support more generic to support an option to use 'nospace' instead of 'default' -- and all of the work that goes with that:
implement as best we can our own 'default' handling for fallback code paths
learn how (if possible) and manually append spaces to option and cmdln-subcommand completions (i.e. so that 'mls --ac' results in 'mls --account ' with a space at the end) and doc how to do that for provided "complete_$argtype" completion functions. See http://stackoverflow.com/a/26511572 for possible help there.
As a follow up to #214 it would be great to improve the Bash completion to support completion of Manta paths, e.g.
mls /trent.mick/stor/a<TAB>
.I started looking at doing this when working on #214 but ran into a road block that'll make this a lot more difficult.
First, the start at this: https://gist.github.com/trentm/401182d1cab8e9d9e1f029bd068ee462 is a start at content to be used for 'specExtra' content to the 'bashCompletion' dashdash and cmdln methods. This is a first stab at handling the 'mpath' completion type. Afterwards support for the 'mdir' type should be done.
The real problem tho is that the above tab completion sucks unless one uses
complete -o nospace
to set it up. Fromman bash
:Without 'nospace' the completion of a dir will append a space, which means to descend into a dir you need to backspace after a completing TAB. That's just painful.
However, currently the dashdash completion stuff is hardwired to use 'complete -o default' and a number of its handling decisions assume 'complete -o default'. Just changing to 'complete -o nospace' would: (a) make completing on options quite different (no space after completing one); and (b) would lose local file/dir completion that you get from '-o default'.
The right answer (or an answer) would be to make dashdash/cmdln completion support more generic to support an option to use 'nospace' instead of 'default' -- and all of the work that goes with that: