How to use the optimist.argv.p function in optimist

To help you get started, we’ve selected a few optimist 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 foreversd / forever-monitor / examples / server.js View on Github external
const util = require('util'),
  http = require('http'),
  argv = require('optimist').argv;

const port = argv.p || argv.port || 80;

http
  .createServer(function(req, res) {
    console.log(req.method + ' request: ' + req.url);
    res.writeHead(200, { 'Content-Type': 'text/plain' });
    res.write('hello, i know nodejitsu.');
    res.end();
  })
  .listen(port);

/* server started */
util.puts('> hello world running on port ' + port);
github sirkitree / pippi / lib / cli.js View on Github external
console.log(err);
        }
        for (var i = projects.length - 1; i >= 0; i--) {
          project_names[projects[i].project.id] = projects[i].project.name;
        }
        var json = JSON.stringify(project_names);
        fs.writeFileSync(config.subdomain + '-projects.json', json);
        console.log('Projects saved to ' + path.join(__dirname, config.subdomain + '-projects.json'));
      });
    }

    // 'log' command

    if (command == 'log') {

      opt.project = opt.project || opt.p;
      opt.message = opt.message || opt.m;
      opt.time = opt.time || opt.t;
      opt.date = opt.date || opt.d;
      opt.user = opt.user || opt.u;

      // --project | -p

      if (opt.project == null) {
        data.missing.push('project');
      } else {

        var intRegex = /^\d+$/
          , projects
          , keys
          , len;
github jsuarez5341 / neural-mmo-client / LegacyWebClient / node_modules / optimist / example / bool.js View on Github external
#!/usr/bin/env node
var util = require('util');
var argv = require('optimist').argv;

if (argv.s) {
    util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: ');
}
console.log(
    (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '')
);
github chrislennon / Crypto-Touchbar-App / node_modules / optimist / example / bool.js View on Github external
#!/usr/bin/env node
var util = require('util');
var argv = require('optimist').argv;

if (argv.s) {
    util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: ');
}
console.log(
    (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '')
);
github pylonide / pylon / configs / default.js View on Github external
var clientExtensions = {};
var clientDirs = fs.readdirSync(__dirname + "/../plugins-client");
for (var i = 0; i < clientDirs.length; i++) {
    var dir = clientDirs[i];
    if (dir.indexOf("ext.") !== 0)
        continue;

    var name = dir.split(".")[1];
    clientExtensions[name] = __dirname + "/../plugins-client/" + dir;
}

var projectDir = process.env.PLN_WORKSPACE || (argv.w && path.resolve(process.cwd(), argv.w)) || process.cwd();
var fsUrl = "/workspace";
var vfsUrl = "/vfs";

var port = argv.p || process.env.PORT || 3131;
var host = argv.l || process.env.IP || "localhost";
var debugPort = argv.b || process.env.DEBUG_PORT || 5858;
var termLocal = process.env.PLN_TERMLOCAL || (host === 'localhost' || host === '127.0.0.1') ? true : false

var useAuth = argv.username && argv.password;

var config = [
    {
        packagePath: "./connect",
        port: port,
        host: host
    }, {
        packagePath: "./connect.static",
        prefix: "/static"
    },
    "./pylon.alive",
github jeromeetienne / better.js / contribs / tmp-to-remove / jsdoc2betterjs / node_modules / node-static / node_modules / optimist / example / bool.js View on Github external
#!/usr/bin/env node
var util = require('util');
var argv = require('optimist').argv;

if (argv.s) {
    util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: ');
}
console.log(
    (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '')
);
github InnovateUKGitHub / innovation-funding-service / ifs-web-service / ifs-core / src / main / resources / static / node_modules / styledocco / node_modules / clean-css / node_modules / optimist / example / bool.js View on Github external
#!/usr/bin/env node
var util = require('util');
var argv = require('optimist').argv;

if (argv.s) {
    util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: ');
}
console.log(
    (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '')
);
github active-video / caching-proxy / lib / caching-proxy.js View on Github external
/**
 * Options
 * -d directory to save cached data to
 * -p  the port to run on, the default is 8092
 * -e  a comma separated list of URL parameters to exclude from the hash, for example rand,cache-buster, etc (will still be included in proxied request, just not used when determining if this request matches a previous one)
 * -s Expose the status API via /status, default is not to if this flag is omitted. If -s is present, then /status will show all pending request as JSON
 * -b Comma separated list of allowed error headers, default is to cache 404 errors
 * -t if 'true' use temporary file only, do not save a cached copy (only transform requests/responses and proxy), default is 'false'.
 * -proxyHost "proxy host", ip or hostname only
 * -proxyPort "proxy port"
 */



var args = require('optimist').argv,
    port = isNaN(parseInt(args.p, 10)) ? 8092 : args.p,
    path = require('path'),
    exclude = (args.e && args.e.trim && args.e.trim()) || '',
    dir = (args.d && args.d.trim && args.d.trim()) || __dirname + '/../data',
    allowedErrors = !args.b ? '404' : (args.b && args.b.toString && args.b.toString().trim()),
    dir = (args.d && args.d.trim && args.d.trim()) || __dirname + '/../data',
    passthrough = (args.T && args.T === 'true') || false,
    proxyHost = args.proxyHost,
    proxyPort = args.proxyPort,

    http = require('http'),
    url = require('url'),
    util = require('util'),
    dateFormat = require('dateformat'),
    Cache = require('./cache'),
    requests = {},
github Raynos / browserify-server / bin / browserify-server.js View on Github external
var fs = require("fs")
var filed = require("filed")
var process = require("process")
var console = require("console")

var Bundle = require("..")
var Server = require("../server")
var Example = require("../example")

var help = argv.help || argv.h
var index = argv.index || argv.i
var bundle = argv.bundle || argv.b
var bundleTarget = typeof bundle === "string" ? bundle : argv._[0]
var server = argv.server || argv.s
var output = argv.output || argv.o
var port = argv.port || argv.p
var example = argv.example || argv.e

argv.debug = argv.debug || argv.d

if (help) {
    filed(path.join(__dirname, "usage.txt")).pipe(process.stdout)
} else if (index) {
    filed(path.join(__dirname, "index.html")).pipe(process.stdout)
} else if (bundle) {
    var data = Bundle(bundleTarget, argv)
    if (output) {
        fs.writeFileSync(output, data, "utf-8")
    } else {
        process.stdout.write(data)
    }
} else if (server) {