How to use the nomnom.script function in nomnom

To help you get started, we’ve selected a few nomnom examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DmitrySoshnikov / syntax / src / bin / syntax.js View on Github external
* The MIT License (MIT)
 * Copyright (c) 2015-present Dmitry Soshnikov 
 */

'use strict';

/*global ROOT:true*/

// To require local modules from root.
global.ROOT = __dirname + '/../';

const colors = require('colors');
const fs = require('fs');
const path = require('path');

const options = require('nomnom')
  .script('syntax')
  .options({
    version: {
      abbr: 'v',
      help: 'Print current version',
      flag: true,
    },
    mode: {
      abbr: 'm',
      transform: normalizeMode,
    },
    grammar: {
      abbr: 'g',
      help: 'File containing LL or LR grammar',
      metavar: 'FILE',
    },
github CMTegner / mdn / index.js View on Github external
#!/usr/bin/env node

var opts = require("nomnom")
    .script("mdn")
    .options({
        search: {
            position: 0,
            help: "Search terms",
            list: true,
            required: true
        },
        version: {
            abbr: "v",
            help: "Print the version and exit",
            flag: true,
            callback: function () {
                return require("./package.json").version;
            }
        }
github zaach / jsonlint / lib / cli.js View on Github external
#!/usr/bin/env node

var fs = require("fs");
var path = require("path");
var parser = require("./jsonlint").parser;
var JSV = require("JSV").JSV;
var formatter = require("./formatter.js").formatter;

var options = require("nomnom")
  .script("jsonlint")
  .options({
    file: {
      position: 0,
      help: "file to parse; otherwise uses stdin"
    },
    version: {
      flag : true,
      string: '-v, --version',
      help: 'print version and exit',
      callback: function() {
        return require("../package").version;
      }
    },
    sort : {
      flag : true,
github zaach / npm-seal / lib / cli.js View on Github external
#!/usr/bin/env node
const fs   = require('fs');
const path = require('path');
const seal = require('./seal');

var opts = require("nomnom")
   .script('seal')
   .option('output', {
      abbr: 'o',
      metavar: 'FILE',
      default: 'sealed-npm-shrinkwrap.json',
      help: 'write output to specified file'
   })
   .option('cache-dir', {
      abbr: 'c',
      metavar: 'DIR',
      default: process.env['HOME'] + '/.npm',
      help: 'directory where npm package downloads are cached'
   })
   .option('version', {
      abbr: 'v',
      flag: true,
github zaach / jison / lib / cli.js View on Github external
function getCommandlineOptions () {
    "use strict";
    var version = require('../package.json').version;
    var opts = require("nomnom")
        .script('jison')
        .option('file', {
            flag : true,
            position : 0,
            help : 'file containing a grammar'
        })
        .option('lexfile', {
            flag : true,
            position : 1,
            help : 'file containing a lexical grammar'
        })
        .option('json', {
            abbr : 'j',
            flag : true,
            help : 'force jison to expect a grammar in JSON format'
        })

nomnom

Option parser with generated usage and commands

MIT
Latest version published 10 years ago

Package Health Score

50 / 100
Full package analysis