<commit_before>/****************************************************************************
**
** Copyright (C) 2012 - 2013 Jolla Ltd.
** Contact: http://jolla.com/
**
** This file is part of Qt Creator.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Digia.
**
****************************************************************************/

#include "commandfactory.h"
#include "qmakecommand.h"
#include "generatekeyscommand.h"
#include "gcccommand.h"
#include "makecommand.h"
#include "deploycommand.h"
#include "rpmcommand.h"
#include <mer/merconstants.h>
#include <QCoreApplication>
#include <QProcessEnvironment>
#include <QFile>
#include <QStringList>
#include <QDir>
#include <QTimer>

void printUsage()
{
    qCritical()
            << "merssh usage:" << endl
            << "merssh <command>" << endl
            << "environment project parameters:" << endl
            << Mer::Constants::MER_SSH_TARGET_NAME << endl
            << Mer::Constants::MER_SSH_SHARED_HOME << endl
            << Mer::Constants::MER_SSH_SHARED_TARGET << endl
            << Mer::Constants::MER_SSH_SHARED_SRC << endl
            << Mer::Constants::MER_SSH_SDK_TOOLS << endl
            << Mer::Constants::MER_SSH_PROJECT_PATH << endl
            << Mer::Constants::MER_SSH_DEVICE_NAME << endl
            << "evironment connection parameters:" << endl
            << Mer::Constants::MER_SSH_USERNAME << endl
            << Mer::Constants::MER_SSH_PORT << endl
            << Mer::Constants::MER_SSH_PRIVATE_KEY << endl;
}

QStringList quoteArguemnts(QStringList args){

    QStringList result;
    QRegExp reg(QLatin1String("^'(.*)'$"));

    foreach (const QString arg,args) {
        if (reg.indexIn(arg) != -1){
            if (arg.indexOf(QLatin1Char(' ')) > -1)
                result.append(arg);
            else
                result.append(reg.cap(1));
        } else  if (arg.indexOf(QLatin1Char(' ')) == -1) {
            result.append(arg);
        } else {
            QString message = QString::fromLatin1("Unquoted argument found  '%1'. Skipping...\n").arg(arg);
            fprintf(stderr, "%s", qPrintable(message));
            fflush(stderr);
        }
    }
    return result;
}

int main(int argc, char *argv[])<commit_msg>Jolla: Add extra quote check for merssh<commit_after>/****************************************************************************
**
** Copyright (C) 2012 - 2013 Jolla Ltd.
** Contact: http://jolla.com/
**
** This file is part of Qt Creator.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** Other Usage
**
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Digia.
**
****************************************************************************/

#include "commandfactory.h"
#include "qmakecommand.h"
#include "generatekeyscommand.h"
#include "gcccommand.h"
#include "makecommand.h"
#include "deploycommand.h"
#include "rpmcommand.h"
#include <mer/merconstants.h>
#include <QCoreApplication>
#include <QProcessEnvironment>
#include <QFile>
#include <QStringList>
#include <QDir>
#include <QTimer>

void printUsage()
{
    qCritical()
            << "merssh usage:" << endl
            << "merssh <command>" << endl
            << "environment project parameters:" << endl
            << Mer::Constants::MER_SSH_TARGET_NAME << endl
            << Mer::Constants::MER_SSH_SHARED_HOME << endl
            << Mer::Constants::MER_SSH_SHARED_TARGET << endl
            << Mer::Constants::MER_SSH_SHARED_SRC << endl
            << Mer::Constants::MER_SSH_SDK_TOOLS << endl
            << Mer::Constants::MER_SSH_PROJECT_PATH << endl
            << Mer::Constants::MER_SSH_DEVICE_NAME << endl
            << "evironment connection parameters:" << endl
            << Mer::Constants::MER_SSH_USERNAME << endl
            << Mer::Constants::MER_SSH_PORT << endl
            << Mer::Constants::MER_SSH_PRIVATE_KEY << endl;
}

QStringList quoteArguemnts(QStringList args){

    QStringList result;
    QRegExp reg1(QLatin1String("^'(.*)'$"));
    QRegExp reg2(QLatin1String("^\"(.*)\"$"));

    foreach (const QString arg,args) {
        if (reg1.indexIn(arg) != -1){
            if (arg.indexOf(QLatin1Char(' ')) > -1)
                result.append(arg);
            else
                result.append(reg1.cap(1));
        } else if (reg2.indexIn(arg) != -1){
            if (arg.indexOf(QLatin1Char(' ')) > -1)
                result.append(arg);
            else
                result.append(reg2.cap(1));
        }  else  if (arg.indexOf(QLatin1Char(' ')) == -1) {
            result.append(arg);
        } else {
            QString message = QString::fromLatin1("Unquoted argument found  '%1'. Skipping...\n").arg(arg);
            fprintf(stderr, "%s", qPrintable(message));
            fflush(stderr);
        }
    }
    return result;
}

int main(int argc, char *argv[])
{'fraction_non_alphanumeric': 0.1807127174463773, 'fraction_numerical': 0.00962675223779767, 'mean_word_length': 3.1239554317548746, 'pattern_counts': {'":': 0, '<': 131, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3484066', 'n_tokens_mistral': 1756, 'n_tokens_neox': 1667, 'n_words': 445}