chore: reformat

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu
2023-08-02 18:35:35 +02:00
parent ce2ca13815
commit 1d468ac35a
594 changed files with 16040 additions and 16536 deletions

View File

@ -41,8 +41,7 @@
* @file libutil/src/cmdutils.cpp
*/
namespace Commandline
{
namespace Commandline {
// commandline splitter
QStringList splitArgs(QString args)
@ -51,19 +50,15 @@ QStringList splitArgs(QString args)
QString current;
bool escape = false;
QChar inquotes;
for (int i = 0; i < args.length(); i++)
{
for (int i = 0; i < args.length(); i++) {
QChar cchar = args.at(i);
// \ escaped
if (escape)
{
if (escape) {
current += cchar;
escape = false;
// in "quotes"
}
else if (!inquotes.isNull())
{
} else if (!inquotes.isNull()) {
if (cchar == '\\')
escape = true;
else if (cchar == inquotes)
@ -71,18 +66,13 @@ QStringList splitArgs(QString args)
else
current += cchar;
// otherwise
}
else
{
if (cchar == ' ')
{
if (!current.isEmpty())
{
} else {
if (cchar == ' ') {
if (!current.isEmpty()) {
argv << current;
current.clear();
}
}
else if (cchar == '"' || cchar == '\'')
} else if (cchar == '"' || cchar == '\'')
inquotes = cchar;
else
current += cchar;
@ -92,4 +82,4 @@ QStringList splitArgs(QString args)
argv << current;
return argv;
}
}
} // namespace Commandline