Support for multi-line shell command

This commit is contained in:
zawz 2019-07-08 06:27:17 +02:00
parent 49195c1553
commit fa7041f191
2 changed files with 19 additions and 0 deletions

3
README
View file

@ -127,3 +127,6 @@ x single value x
Comments can be done with //
note: // in value lines will not be ignored
A shell command can be written on multiple lines by containing it between '' right after =
note: additional ' in command need to be escaped with \

View file

@ -492,6 +492,22 @@ std::pair<std::string,std::string> readValue(std::string const& in, unsigned int
ret += '\"';
return std::make_pair(name, ret);
}
else if(in[i]=='\'')
{
i++;
j++;
while(i<in.size() && in[i]!='\'')
{
if(in[i]=='\\')
i++;
i++;
}
if(rank!=nullptr)
*rank=i+1;
std::string ret;
ret += in.substr(j,i-j);
return std::make_pair(name, ret);
}
else /*Valeur non encapsulée: jusqu'à \n*/
{
i++;