How to use nomnom

Comprehensive nomnom code examples:

How to use nomnom.inputs:

57
58
59
60
61
62
63
64
65
66
67
    return point;
}


// Combine inputs into one master device list
var devices = {};
for (var i = 0; i < opts.inputs.length; i++) {
    var jPhotos = JSON.parse(fs.readFileSync(opts.inputs[i]));
    for (var serial in jPhotos.devices) {
        var jDev = jPhotos.devices[serial];
        jDev._filename = opts.inputs[i];

How to use nomnom.nocolors:

83
84
85
86
87
88
89
90
91
92
    if (typeof plugins[id].help === 'string')
        command.help(plugins[id].help);
});
// TODO: should be deactivated as well when PhantomJS does not execute in a TTY context
if (system.os.name === 'windows')
    parser.nocolors();

var options = parser.parse(system.args.slice(1));

page.onLoadStarted = function () {

How to use nomnom.r:

8
9
10
11
12
13
14
15
16
17
18
var opts = require("nomnom").parse();


var passed_repo = opts.repo
var passed_device = opts.device
if(passed_repo == undefined){
    passed_repo = opts.r;
}
if(passed_device == undefined){
    passed_device = opts.d;
}

How to use nomnom.device:

6
7
8
9
10
11
12
13
14
15
16
var mkdirp = require('mkdirp');
const { exit } = require('process');
var opts = require("nomnom").parse();


var passed_repo = opts.repo
var passed_device = opts.device
if(passed_repo == undefined){
    passed_repo = opts.r;
}
if(passed_device == undefined){

How to use nomnom.d:

11
12
13
14
15
16
17
18
19
20
21
var passed_device = opts.device
if(passed_repo == undefined){
    passed_repo = opts.r;
}
if(passed_device == undefined){
    passed_device = opts.d;
}


var iOSDevices = [];
var androidDevices = [];

How to use nomnom.repo:

5
6
7
8
9
10
11
12
13
14
15
var gh = require('parse-github-url');
var mkdirp = require('mkdirp');
const { exit } = require('process');
var opts = require("nomnom").parse();


var passed_repo = opts.repo
var passed_device = opts.device
if(passed_repo == undefined){
    passed_repo = opts.r;
}

How to use nomnom.striplimit:

565
566
567
568
569
570
571
572
573
574
575
576
577
    }


    leds.sort(function (a,b) { return a.stripPosition - b.stripPosition; });


    leds = leds.filter(function(led) {
        return led.stripIndex < opts.striplimit;
    });


    return leds;
}

How to use nomnom.print:

36
37
38
39
40
41
42
jscodeshift.run(
  path.join(__dirname, '../src/transform.js'),
  [path.join(process.cwd(), opts.src)],
  {
    dry: opts.dry,
    print: opts.print
  });

How to use nomnom.dest:

35
36
37
38
39
40
41
42
43
44
  }
});

var server = require('../index')({
  proxy: opts.proxy,
  dest : opts.dest
});

server.listen(opts.port);
winston.info('http tunneling server to %s through %s listening from %d', opts.dest, opts.proxy, opts.port);

How to use nomnom.help:

76
77
78
79
80
81
82
83
84
85
    '\tnpm-cache install --forceRefresh  bower\t# force installing dependencies from package manager without cache',
    '\tnpm-cache install --noArchive npm\t# do not compress/archive the cached dependencies',
    '\tnpm-cache clean\t# cleans out all cached files in cache directory',
    '\tnpm-cache hash\t# reports the current working hash'
  ];
  parser.help(examples.join('\n'));

  var npmCacheArgs = ParseUtils.getNpmCacheArgs();
  parser.parse(npmCacheArgs);
};

How to use nomnom.disease:

33
34
35
36
37
38
39
40
41
42
    .parse();

var url = 'mongodb://localhost:27017/' + opts.db;

// Grab the path from the command line
var path = opts.disease;
if (!path) {
    util.log('Must specify an XML file as a source.');
    return;
}

How to use nomnom.db:

30
31
32
33
34
35
36
37
38
39
        default: 'Disease',
        help: 'Name of the database collection to write to'
    })
    .parse();

var url = 'mongodb://localhost:27017/' + opts.db;

// Grab the path from the command line
var path = opts.disease;
if (!path) {

How to use nomnom.sortConfig:

92
93
94
95
96
97
98
99
100
101
  .parse();

const transform = appRoot + '/dist/index.js';

let sortConfig;
const sortConfigPath = opts.sortConfig;
if (sortConfigPath) {
  try {
    sortConfig = JSON.parse(fs.readFileSync(path.resolve(sortConfigPath)));
  } catch (err) {

How to use nomnom.cappedCollectionSize:

5
6
7
8
9
10
11
12
13
14
var opts = require('../options');

var reportOptions = {};
if (opts.cappedCollectionSize !== 0) {
  logger.info('Capping report collection at', opts.cappedCollectionSize);
  reportOptions.capped = opts.cappedCollectionSize;
}

var ReportSchema = new Schema({
  project: {type: Schema.Types.ObjectId, ref: 'Project'},

How to use nomnom.verbose:

109
110
111
112
113
114
115
116
117
118
        }
}));
app.get('/build.js', browserify(path.join(staticFolder, 'index.js'), {
        transform: ['reactify'],
        watch: opts.develop,
        debug: opts.verbose
}));
app.use(express.static(staticFolder));
app.use('/output', express.static(sharedPaths.output));
var server = http.createServer(app);

How to use nomnom.option:

39
40
41
42
43
44
45
46
47
48
  } else {
    defaultCacheDirectory = path.resolve('/tmp', '.package_cache');
  }
}

parser.option('cacheDirectory', {
  default: defaultCacheDirectory,
  abbr: 'c',
  help: 'directory where dependencies will be cached'
});

How to use nomnom.script:

6
7
8
9
10
11
12
13
14
15
var opts       = require('nomnom'),
    utils      = require('../lib/utils'),
    dynroute   = require('../dynroute'),
    configFile = process.env.HOME + '/.awsrc';

opts = opts.script('dynroute')
  .option('domain', {
    abbr     : 'd',
    required : true,
    help     : 'Domain(s) to update [required]',

How to use nomnom.parse:

85
86
87
88
89
90
91
92
93
94
});
// TODO: should be deactivated as well when PhantomJS does not execute in a TTY context
if (system.os.name === 'windows')
    parser.nocolors();

var options = parser.parse(system.args.slice(1));

page.onLoadStarted = function () {
    console.log('Loading page ' + options.url + ' ...');
};

How to use nomnom.message:

53
54
55
56
57
58
59
60
61
  }
})
.help("Install a dependency in the base of your project")
.callback(function(input) {
 if(!npm.isSailorProyect(process.cwd()))
   parser.message.error("First create a new base project.", 1);

 if(npm.isAlreadyInstalled(process.cwd(), input[1]))
   parser.message.error("Module '" + input[1] + "' is already installed.", 1);

How to use nomnom.command:

75
76
77
78
79
80
81
82
83
84
    'specified <url> and uses it to export and write the PDF into the specified <filename>.');
parser.command('automatic')
    .help('Iterates over the available plugins, picks the compatible one for presentation at the \n' +
    'specified <url> and uses it to export and write the PDF into the specified <filename>.');
Object.keys(plugins).forEach(function (id) {
    var command = parser.command(id);
    if (typeof plugins[id].options === 'object')
        command.options(plugins[id].options);
    if (typeof plugins[id].help === 'string')
        command.help(plugins[id].help);

How to use nomnom.options:

58
59
60
61
62
63
64
65
66
67

/**
 * If running this module directly start the server.
 */
if (require.main === module) {
  var options = nomnom.options({
    port: {
      abbr: 'p',
      default: 3000,
      help: 'Port for incoming connections',