How to use the nopt function in nopt

To help you get started, we’ve selected a few nopt 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 yuanqing / line-clamp / gulp / example.js View on Github external
gulp.task('example:serve', () => {
  http.createServer(ecstatic({
    root: './example'
  })).listen(4242);
  const args = nopt({
    open: Boolean
  }, {
    o: ['--open']
  });
  if (args.open) {
    const url = 'http://localhost:4242';
    gutil.log(gutil.colors.green('Opening', url));
    opn(url, {
      app: 'google chrome',
      wait: false
    });
  }
});
github csi-lk / aws-ses-local / src / library / options.js View on Github external
import nopt from 'nopt'
import path from 'path'

const opts = {
  outputDir: path,
  port: Number,
  clean: Boolean,
}
const shortOpts = {
  o: ['--outputDir'],
  p: ['--port'],
  c: ['--clean'],
}
const output = nopt(opts, shortOpts, process.argv, 2)

output.outputDir = (output.outputDir === undefined) ? './output' : output.outputDir
output.port = (output.port === undefined) ? '9001' : output.port

export default output
github rtfpessoa / diff2html / scripts / hulk.ts View on Github external
*
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

import * as path from "path";
import * as fs from "fs";

import * as hogan from "hogan.js";
import nopt from "nopt";
import * as mkderp from "mkdirp";

const options = nopt(
  {
    namespace: String,
    outputdir: path,
    variable: String,
    wrapper: String,
    version: true,
    help: true
  },
  {
    n: ["--namespace"],
    o: ["--outputdir"],
    vn: ["--variable"],
    w: ["--wrapper"],
    h: ["--help"],
    v: ["--version"]
  }

nopt

Option parsing for Node, supporting types, shorthands, etc. Used by npm.

ISC
Latest version published 5 days ago

Package Health Score

92 / 100
Full package analysis