osx - Custom Bash Autocomplete with File Path Completion -
i'm working on bash auto-completion project i'm maintainer of. can find script here. i've cobbled hacking on own, , of contributors understand completion apis better do.
what have works great -- 1 exception. can manage completion like this
//type pestle.phar som[tab] //completes pestle.phar some-command-name
however, once we're here lose file path/name completion that's part of stock bash shell. is, working off previous example, if user types
//type pestle.phar some-command-name /va[tab]
we'd complete to
//completes following, because var exists pestle.phar some-command-name /var
is there way tell complete
command like
hey, in addition we're telling our custom bash function, keep normal file path completion
if not, there there known science/boilerplate reimplementing file path completion in own custom base completion functions?
some other answers , the docs seem indicate -o filenames
or -o bashdefault
options should take care of -- doesn't seem working on os x 10.11. i'm not sure if misunderstand -o
, or if code in completion files somehow overrides -o
behavior, or if os x doing it's i'm behaved unix thing.
also -- if it's not obvious -- is first deep bash completion rodeo. if i've said seemingly dumb/naive above please let me know. may looking fish right now, i'd learn to fish in bash completion river myself.
i think -o default
(without -o filenames
) should work you. according manual:
- bashdefault
perform rest of default bash completions if compspec generates no matches.- default
use readline's default filename completion if compspec generates no matches.- filenames
tell readline compspec generates filenames, can perform filename-specific processing (like adding slash directory names, quoting special characters, or suppressing trailing spaces). intended used shell functions.
(also see 'complete -d -o default cd' issue
difference between -o default
, -o bashdefault
.)
Comments
Post a Comment