rherrmann / gonsole

Gonsole - Git Console for the Eclipse IDE
http://gonsole.codeaffine.com
37 stars 10 forks source link

multiline cmdline arguments #58

Open CrystalMethod opened 8 years ago

CrystalMethod commented 8 years ago

It shall be possible to use multi-line cmdline input. Something like temporary files in unix shells, as follows:

$ cat <<EOF
> hello
> world
> EOF
$ 

https://en.wikipedia.org/wiki/Here_document

Use case: I would like to pass JSON snippets as cmd line arguments.

rherrmann commented 8 years ago

Can you give an example of a git command that would use the multi-line input?

CrystalMethod commented 8 years ago

Well my issue has been so unclearly formulated. IMO, it is regarding console.core. I've started a http-console based on your project. You might know https://github.com/cloudhead/http-console, https://github.com/mattn/http-gonsole and thelike. While most HTTP commands are easy to implement, POST and PUT look somewhat different. When using POST/PUT one can send the body data. My idea is to provide some kind of "sub prompt", "body prompt" or "data prompt" for this kind of commands. (which seems similar to "here document" linked in the initial comment)

http://127.0.0.1:5984/rabbits> POST     // command opening a "data prompt"
> {"name":"Roger"}                      // 1-n lines "data prompt"
>                                       // special keystroke to leave the "data prompt"
>                                       // ... and issue the POST command
HTTP/1.1 201 Created                    // result
http://127.0.0.1:5984/rabbits>

Currently com.codeaffine.console.core.ConsoleCommandInterpreter.execute(...) will be executed per single command line. I don't see any chance to inject the "data prompt".

rherrmann commented 8 years ago

Sure, that absolutely makes sense.

guw commented 7 years ago

Instead of a data prompt, #70 would give commands the opportunity to grab the input and read anything they want out of it.