aureliojargas / clitest

Command Line Tester
MIT License
143 stars 12 forks source link

Multiline commands #30

Closed marcioAlmada closed 4 years ago

marcioAlmada commented 6 years ago

I'd like to run a command with a multiline string, but could not succeed:

Ex.:

This should store a multiline string into a variable:

$ MY_VAR='
{
    "error": {
        "messages": {
            "foo": "The parameter bar is out of range"
        }
    }
}
'
$

Proceed and use the variable...

$ echo "$MY_VAR"

{
    "error": {
        "messages": {
            "foo": "The parameter bar is out of range"
        }
    }
}

$

Currently I'm storing the assert string into a file, but most of the team prefer things inline. Perhaps we are doing multi line commands wrong or was this actually intended?

aureliojargas commented 4 years ago

@marcioAlmada Unfortunately, multiline commands are not supported. Supporting it would probably involve writing a mini shell parser to detect quoting, escaping, nesting, subshells, etc., and that's outside of the scope of this tool.

Using an external file is the alternative.

I'm sorry for taking so long to answer.