//
// Created by Ht on 2019/12/25.
//

#ifndef LIBGOING_JCARGUTIL_H
#define LIBGOING_JCARGUTIL_H


#include <jebase/config.h>

#include "JCCmdRunner.h"
#include "JCArgNode.h"
#include "JCStreamInput.h"

static const char* vkey_param_default = "@para";
static const char* vkey_auto_start_cmd = "@s";
static const char* vkey_origin_comamnd = "@orgcmd";

class JE_API JCArgUtil {

public:
    static void handleArgs(int argc, const char* argv[], qlibc::JCArgNode& node, char quoteChar = '\'');

    static void handleArgs(const std::string& cmdline, qlibc::JCArgNode& node, char quoteChar = '\'');

    static void handleArgs(const QStringList & cmdline, qlibc::JCArgNode& node, char quoteChar = '\'');

    static void handleActionArgs(qlibc::JCArgNode &argData, const string &param_str);

    static void run(qlibc::JCCmdRunner &runner, qlibc::JCArgNode node, const qlibc::JCStreamInput* input = nullptr, bool backRun = false);

    static void readFromInputStream(const qlibc::JCStreamInput* input);

    static void tryShowPrompt();
};



#endif //LIBGOING_JCARGUTIL_H
