Skip to content
This repository has been archived by the owner on Sep 12, 2021. It is now read-only.

multiline cmdline arguments #58

Open
CrystalMethod opened this issue Nov 25, 2015 · 4 comments
Open

multiline cmdline arguments #58

CrystalMethod opened this issue Nov 25, 2015 · 4 comments

Comments

@CrystalMethod
Copy link
Contributor

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
Copy link
Owner

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

@CrystalMethod
Copy link
Contributor Author

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
Copy link
Owner

Sure, that absolutely makes sense.

@guw
Copy link
Contributor

guw commented Dec 6, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants