HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/shop.komma.nl/node_modules/@oclif/command/lib/main.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const _1 = require(".");
const plugin_help_1 = require("@oclif/plugin-help");
const ROOT_INDEX_CMD_ID = '';
class Main extends _1.Command {
    static run(argv = process.argv.slice(2), options) {
        return super.run(argv, options || (module.parent && module.parent.parent && module.parent.parent.filename) || __dirname);
    }
    async init() {
        const [id, ...argv] = this.argv;
        await this.config.runHook('init', { id, argv });
        return super.init();
    }
    async run() {
        let [id, ...argv] = this.argv;
        this.parse(Object.assign({ strict: false, '--': false }, this.ctor));
        if (!this.config.findCommand(id)) {
            const topic = this.config.findTopic(id);
            if (topic)
                return this._help();
            if (this.config.findCommand(ROOT_INDEX_CMD_ID)) {
                id = ROOT_INDEX_CMD_ID;
                argv = this.argv;
            }
        }
        await this.config.runCommand(id, argv);
    }
    _helpOverride() {
        if (['-v', '--version', 'version'].includes(this.argv[0]))
            return this._version();
        if (['-h', 'help'].includes(this.argv[0]))
            return true;
        if (this.argv.length === 0 && !this.config.findCommand(ROOT_INDEX_CMD_ID))
            return true;
        for (const arg of this.argv) {
            if (arg === '--help')
                return true;
            if (arg === '--')
                return false;
        }
        return false;
    }
    _help() {
        const HelpClass = plugin_help_1.getHelpClass(this.config);
        const help = new HelpClass(this.config);
        help.showHelp(this.argv);
        return this.exit(0);
    }
}
exports.Main = Main;
function run(argv = process.argv.slice(2), options) {
    return Main.run(argv, options);
}
exports.run = run;