gonsole icon indicating copy to clipboard operation
gonsole copied to clipboard

multiline cmdline arguments

Open CrystalMethod opened this issue 8 years ago • 4 comments

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.

CrystalMethod avatar Nov 25 '15 16:11 CrystalMethod

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

rherrmann avatar Nov 26 '15 15:11 rherrmann

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".

CrystalMethod avatar Nov 26 '15 18:11 CrystalMethod

Sure, that absolutely makes sense.

rherrmann avatar Nov 26 '15 21:11 rherrmann

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

guw avatar Dec 06 '16 01:12 guw