<commit_before>module.exports = class CommandlineArgumentExtractor {

    constructor(argv) {
        this._argv = argv;
    }

    _get(key, isFlag) {
        let option = this._argv.find(arg => arg.startsWith(key + '='));
        let index = this._argv.findIndex(arg => arg === key);

        if(isFlag) {
            return index > -1 || option !== undefined;
        }

        if(option) {
            let value = option.split('=')[1];
            return !value ? undefined : value;
        }

        if(index > -1 && index + 1 < this._argv.length) {
            let value = this._argv[index + 1];
            return value.startsWith('-') ? undefined : value;
        }

        return undefined;
    }

    /**
     * Extract <Configuration> compatible options from the arguments provided through the commandline
     */
    get options() {
        return {
            proxyRules:                   this._get('--proxy-server'),
            applicationUpdateURL:         this._get('--update-url') || this._get('-u'),
            applicationStartupURL:        this._get('--startup-url'),
            applicationCacheDirectory:    this._get('--cache-directory') || this._get('-c'),
            applicationUserDataDirectory: this._get('--user-directory')
        };
    }
}<commit_msg>temporarily added developer options<commit_after>module.exports = class CommandlineArgumentExtractor {

    constructor(argv) {
        this._argv = argv;
    }

    _get(key, isFlag) {
        let option = this._argv.find(arg => arg.startsWith(key + '='));
        let index = this._argv.findIndex(arg => arg === key);

        if(isFlag) {
            return index > -1 || option !== undefined;
        }

        if(option) {
            let value = option.split('=')[1];
            return !value ? undefined : value;
        }

        if(index > -1 && index + 1 < this._argv.length) {
            let value = this._argv[index + 1];
            return value.startsWith('-') ? undefined : value;
        }

        return undefined;
    }

    /**
     * Extract <Configuration> compatible options from the arguments provided through the commandline
     */
    get options() {
        // TODO: remove this developer check and add command line args to npm script when starting in developer mode ...
        if(require('path').basename(process.execPath).startsWith('electron')) {
            return {
                applicationUpdateURL: 'DISABLED',
                applicationCacheDirectory: '../web'
            };
        } else {
            return {
                proxyRules:                   this._get('--proxy-server'),
                applicationUpdateURL:         this._get('--update-url') || this._get('-u'),
                applicationStartupURL:        this._get('--startup-url'),
                applicationCacheDirectory:    this._get('--cache-directory') || this._get('-c'),
                applicationUserDataDirectory: this._get('--user-directory')
            };
        }
    }
}
{'fraction_non_alphanumeric': 0.134936539746159, 'fraction_numerical': 0.0033400133600534404, 'mean_word_length': 1.7990654205607477, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3388661', 'n_tokens_mistral': 802, 'n_tokens_neox': 775, 'n_words': 172}