summaryrefslogtreecommitdiff
path: root/index.js
blob: 413fb738322fbc556c5fcb192c4a0dbe1d6a5157 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
global.version = "0.1";

const yargs = require('yargs/yargs')()
    .scriptName(process.argv0)
    .usage('$0 [<options>] [<argument> ...]')
    .version(false)
    .options({
        'version': {
            alias: 'v',
            type: 'boolean',
            description: 'Shows version number'
        }
    })
    .help();

yargs.parse(process.argv, function yargsCallback(err, args, output) {
    if (output) {
        output = output.replace(/\[\w+\]/g, '');
        console.log(output);
        return;
    }

    if (args.version) {
        console.log("unish " + version);
    } else {
        require('./core/shell');
    }
});