propensive / fury-old

A new build tool for JVM languages
Apache License 2.0
413 stars 34 forks source link

tab completion for bash and fish #17

Open propensive opened 6 years ago

propensive commented 6 years ago

Fury currently only supports tab completion in ZSH, which provides a superset of Bash's functionality. It should not be too difficult to emit Bash completion output derived from the information which is already generated for ZSH.

I know nothing about Fish, though.

martinpallmann commented 5 years ago

I‘m a fish user and would be willing to take a look. (I also have no clue how it works though. So no guarantees for the result)

propensive commented 5 years ago

Thanks, @martinpallmann! The source code will be released on 15 November, and you can take a look at what I do for zsh. There are two parts: the shell-side, which passes the current command line details to Fury and interprets the output, and the Fury-side which generates that output. It should be exactly the same workflow for bash and fish, just with different output.

propensive commented 5 years ago

To support bash completion we will assume that Fury will output a newline-delimited list of suggestions when it is invoked with,

fury completion --shell bash --paramNo <parameter number of cursor> -- <current commandline commands>

For example, the command,

fury source add -d fi<tab>

would invoke

fury completion --shell bash --paramNo 3 -- source add -d fi

Entries in the output from this command will not be escaped at all, so there may be a requirement to hack them into shape before passing them through to the Bash completion system if they contain characters which may be interpreted in interesting ways.