How to use coa - 10 common examples

To help you get started, we’ve selected a few coa 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 eschirtz / Computer-Science-Series / node_modules / svgo / lib / svgo / coa.js View on Github external
writeFile = promisify(FS.writeFile),
    SVGO = require('../svgo.js'),
    YAML = require('js-yaml'),
    PKG = require('../../package.json'),
    encodeSVGDatauri = require('./tools.js').encodeSVGDatauri,
    decodeSVGDatauri = require('./tools.js').decodeSVGDatauri,
    regSVGFile = /\.svg$/,
    noop = () => {},
    svgo;

/**
 * Command-Option-Argument.
 *
 * @see https://github.com/veged/coa
 */
module.exports = require('coa').Cmd()
    .helpful()
    .name(PKG.name)
    .title(PKG.description)
    .opt()
        .name('version').title('Version')
        .short('v').long('version')
        .only()
        .flag()
        .act(function() {
            // output the version to stdout instead of stderr if returned
            process.stdout.write(PKG.version + '\n');
            // coa will run `.toString` on the returned value and send it to stderr
            return '';
        })
        .end()
    .opt()
github vkz / bemhtml-syntax / lib / coa.js View on Github external
m: "max_preserve_newlines",
  j: "jslint_happy",
  a: "space_after_anon_function",
  b: "brace_style",
  k: "keep_array_indentation",
  // no such cli flag in js-beautifier
  K: "keep_function_indentation",
  // no such cli flag in js-beautifier
  A: "no_space_before_conditional",
  B: "break_chained_methods",
  x: "unescape_strings",
  w: "wrap_line_length",
  n: "end_with_newline"
};

var cmd = module.exports = require('coa').Cmd();

function addBeautfierOpts(cmd) {

  Object.keys(js_beautifier_opts).forEach(function (o) {
    var NAME = js_beautifier_opts[o],
        FLAG = (typeof js_beatufier_defaults[NAME]) === 'boolean',
        LONG = NAME.replace(/_/g,'-'),
        DEF = js_beatufier_defaults[NAME],
        TITLE = '(default: ' + DEF + ')';
    var result = cmd.opt().name(NAME).title(TITLE)
          .short(o).long(LONG);

    if (FLAG)
      return result.flag().end();

    return result.val(function (v) {
github Yeti-or / deps-formatter / cli.js View on Github external
var coa = require('coa');
var pkg = require('./package.json');

var formatter = require('.');

module.exports = coa.Cmd()
    .helpful()
    .name(pkg.name)
    .title(pkg.description)
    .opt()
        .name('version').title('Version')
        .short('V').long('version')
        .only()
        .flag()
        .act(function() {
            // output the version to stdout instead of stderr if returned
            process.stdout.write(pkg.version + '\n');
            // coa will run `.toString` on the returned value and send it to stderr
            return '';
        })
        .end()
    .opt()
github borschik / borschik / lib / coa.js View on Github external
var PATH = require('path');
var fs = require('fs');

var util = require('./util');

module.exports = require('coa').Cmd()
    .name(process.argv[1])
    .title('Borschik. Extendable builder for text-based file formats.')
    .helpful()
    .opt()
        .name('version') .title('Version')
        .short('v').long('version')
        .flag()
        .only()
        .act(function() { return JSON.parse(fs.readFileSync(PATH.resolve(__dirname, '..', 'package.json'))).version })
        .end()
    .opt()
        .name('tech') .title('Technology')
        .short('t').long('tech')
        .end()
    .opt()
        // Give ability for external technologies to has its own options without conflicts with borschik
github mihaild / ybundler / lib / ybundler.js View on Github external
if (DEBUG) {
            console.log();
            console.log('mega:');
            console.log(beautify_bundling(mega.bundling).pages);
            console.log(mega.cost);
        }
        else {
            var bundling = beautify_bundling(mega.bundling);
            output.write('exports.bundling = ' + JSON.stringify(bundling) + ';');
        }
    }
}

exports.get_bundling = get_bundling;

exports.COA = require('coa').Cmd()
    .name(process.argv[1])
    .title('Bundler. It is better for you to not know what it is.')
    .helpful()
    .opt()
        .name('file_cost')
        .title('file cost, default: 10')
        .def(10)
        .long('file-cost')
        .end()
    .opt()
        .name('kb_cost')
        .title('kb cost, default: 2')
        .def(2)
        .long('kb-cost')
        .end()
    .opt()
github veged / shmakowiki / lib / cli.js View on Github external
exports.main = function () {

    var util = require('util'),
        fs = require('fs'),
        q = require('q');

    require('coa').Cmd()
        .name(process.argv[1])
        .title('Shmakowiki command line utility')
        .helpful()
        .opt()
            .name('version')
            .title('Show version')
            .long('version')
            .flag()
            .only()
            .act(function(opts) {
                return JSON.parse(require('fs').readFileSync(__dirname + '/../package.json'))
                    .version;
            })
            .end()
        .opt()
            .name('input')
github selenodium / selenodium-grid / lib / coa.js View on Github external
'use strict';

var path = require('path'),
    extend = require('extend'),
    pkg = require('../package.json'),
    main = require('./hub').main;

module.exports = require('coa').Cmd()
    .name(path.basename(process.argv[1]))
    .title(pkg.description)
    .helpful()
    .arg()
        .name('port')
        .title('Port to listen')
        .end()
    .arg()
        .name('host')
        .title('Host to listen')
        .end()
    .opt()
        .name('config')
        .title('Hub config')
        .short('c')
        .long('config')
github manolo / gwt-api-generator / bin / gwt-api-generator.js View on Github external
#!/usr/bin/env node
'use strict';
var gulp = require('gulp')
require('../gulpfile');

require('coa').Cmd()
  .name(process.argv[1])
  .title('gwt-api-generator')
  .helpful()
  .opt()
    .name('package')
    .title('Bower package(s) to use. Multiple packages can be defined with: package="foo bar" or package=foo,bar')
    .long('package')
    .end()
  .opt()
    .name('Java directory')
    .title('Directory where the Java files are generated. (Default: src/main/java)')
    .long('javaDir')
    .end()
  .opt()
    .name('Resources directory')
    .title('Directory where the Resource files are generated. (Default: src/main/resources)')
github veged / yajsh / lib / coa.js View on Github external
var COA = exports.COA = require('coa').Cmd()
    .name('yajsh').helpful()
    .opt()
        .name('version').title('Version')
        .short('v').long('version')
        .only()
        .flag()
        .act(function(opts) {
            return JSON.parse(require('fs').readFileSync(__dirname + '/../package.json')).version;
        })
        .end()
    .opt()
        .name('input').title('Input file (default: stdin)')
        .short('i').long('input')
        .input()
        .end()
    .opt()
github veged / krasota.js / lib / coa.js View on Github external
function beautifiersOpt() {
    this.opt()
        .name('beautifiers').title('Local or global path to beautifier module, can be used many times')
        .short('b').long('beautifier')
        .arr()
        .req()
        .val(function(b) {
            return typeof b == 'string'
                ? require(b.match(/^\./) ? require('path').resolve(b) : b).KrasotaJS
                : b
        })
        .end()
}

var COA = exports.COA = require('coa').Cmd()
    .name('krasota').helpful()
    .opt()
        .name('version').title('Version')
        .short('v').long('version')
        .only()
        .flag()
        .act(function(opts) {
            return JSON.parse(require('fs').readFileSync(__dirname + '/../package.json')).version;
        })
        .end()
    .opt()
        .name('input').title('Input file (default: stdin)')
        .short('i').long('input')
        .input()
        .end()
    .opt()

coa

Command-Option-Argument: Yet another parser for command line options.

MIT
Latest version published 6 years ago

Package Health Score

74 / 100
Full package analysis

Popular coa functions