How to use arg - 10 common examples

To help you get started, we’ve selected a few arg 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 marktext / marktext / src / main / cli / parser.js View on Github external
}
  const spec = {
    '--debug': Boolean,
    '--safe': Boolean,
    '--dump-keyboard-layout': Boolean,

    '--new-window': Boolean,
    '-n': '--new-window',

    '--disable-gpu': Boolean,
    '--user-data-dir': String,

    // Misc
    '--help': Boolean,
    '-h': '--help',
    '--verbose': arg.COUNT,
    '-v': '--verbose',
    '--version': Boolean
  }
  return arg(spec, { argv, permissive })
}
github saltyshiomix / react-ssr / packages / express-engine-jsx / src / bin / react-ssr-dev.ts View on Github external
import { resolve } from 'path';
import arg from 'arg';
import chalk from 'chalk';
import delay from 'delay';
import got from 'got';
import serve from './serve';
import * as spinner from './spinner';

const args = arg({});

if (!args._[0]) {
  console.error(chalk.red('Please specify a server entrypoint: `react-ssr server.js`'));
  process.exit(1);
}

const cwd = process.cwd();
const server: string = resolve(cwd, args._[0]);

async function dev() {
  let proc;
  const wrapper = () => {
    if (proc) {
      proc.kill();
    }
  };
github mehmet-erim / symlink-manager / src / cli.js View on Github external
function parseArgumentsIntoOptions(rawArgs) {
  const args = arg(
    {
      '--angular': Boolean,
      '--no-watch': Boolean,
      '--packages': String,
      '--all-packages': Boolean,
      '--excluded-packages': String,
      '--sync-build': Boolean,
      '--sync': Boolean,
      '--yarn': Boolean,
      '-a': '--angular',
      '-y': '--yarn',
    },
    {
      argv: rawArgs,
    },
  );
github zeit / now / packages / now-cli / src / util / get-args.ts View on Github external
export default function getArgs(
  argv: string[],
  argsOptions: T,
  argOptions: ArgOptions = {}
) {
  return arg(Object.assign({}, getCommonArgs(), argsOptions), {
    ...argOptions,
    argv
  });
}

arg

Unopinionated, no-frills CLI argument parser

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis

Popular arg functions