async function wskdebug()

in index.js [275:316]


async function wskdebug(args, isCommandLine=false) {
    log.debug("wskdebug arguments:", args);
    log.enableConsoleColors();

    try {
        const parser = getYargsParser();

        // if cli mode, we want to exit the process, otherwise throw an error
        parser.showHelpOnFail(isCommandLine);
        parser.exitProcess(isCommandLine);

        const argv = parser.parse(args);
        normalizeArgs(argv);

        if (argv.help || argv.version) {
            // do nothing
            return;
        }

        log.isVerbose = argv.verbose;
        log.quiet(argv.quiet);

        try {
            const dbg = new Debugger(argv);
            if (isCommandLine) {
                registerExitHandler(dbg);
            }
            await dbg.start();
            await dbg.run();

        } catch (e) {
            if (isCommandLine) {
                printErrorAndExit(e);
            } else {
                throw e;
            }
        }

    } finally {
        log.resetConsoleColors();
    }
}