How to use the caporal.parse function in caporal

To help you get started, we’ve selected a few caporal 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 fabiospampinato / enex-dump / src / cli.js View on Github external
.action ( () => EnexDump () );

  /* HELP */

  const command = app._defaultCommand;
  const helpLines = [
    `enex-dump ${chalk.green ( '--src' )} ${chalk.blue ( './my-notes.enex' )}`,
    `enex-dump ${chalk.green ( '--src' )} ${chalk.blue ( './my-notes.enex' )} ${chalk.green ( '--format' )} ${chalk.blue ( 'html' )} ${chalk.green ( '--extension' )} ${chalk.blue ( 'html' )}`,
    `enex-dump ${chalk.green ( '--src' )} ${chalk.blue ( './my-notes.enex' )} ${chalk.green ( '--no-metadata' )} ${chalk.green ( '--no-attachments' )}`
  ];

  command.help ( helpLines.join ( '\n' ), { name: 'USAGE - ADVANCED' } );

  /* PARSE */

  caporal.parse ( process.argv );

}
github fabiospampinato / template / src / cli.ts View on Github external
.action ( () => Template.list () )
    /* INSTALL */
    .command ( 'install', 'Install a template from a repository' )
    .argument ( '', 'Git endpoint url, GitHub shorthand or local path' )
    .argument ( '[template]', 'Template name' )
    .action ( args => Template.install ( args.repository, args.template ) )
    /* UNINSTALL */
    .command ( 'uninstall', 'Uninstall one or all templates' )
    .argument ( '[template]', 'Template name' )
    .action ( args => Template.uninstall ( args.template ) )
    /* UPDATE */
    .command ( 'update', 'Update one or all templates' )
    .argument ( '[template]', 'Template name' )
    .action ( args => Template.update ( args.template ) );

  caporal.parse ( process.argv );

}
github crawlab-team / artipub / cli.js View on Github external
const port = cmdObj.port || '27017'
    const db = cmdObj.db || 'artipub'
    const username = cmdObj.username || ''
    const password = cmdObj.password || ''

    process.env.MONGO_HOST = host
    process.env.MONGO_PORT = port
    process.env.MONGO_DB = db
    process.env.MONGO_USERNAME = username
    process.env.MONGO_PASSWORD = password

    // 开启后段服务
    require('./server')
  })

program.parse(process.argv)
github albacoretuna / moro / bin / moro.js View on Github external
// note
  //
  .command('note', COMMAND_DESCRIPTIONS.note)
  .alias('n')
  .argument('[note...]', COMMAND_DESCRIPTIONS.noteNote)
  .action(commands.addNote)
  //
  // ////////////////////
  // about
  //
  .command('about', COMMAND_DESCRIPTIONS.about)
  .alias('a')
  .action(commands.about)

// let it begin!
prog.parse(process.argv)
github nestjs / nest-cli / src / index.ts View on Github external
public static async start(version) {
    program
      .version(version)
      .help('Nest.js CLI');
    new NewCommand().declare(program);
    new GenerateCommand().declare(program);
    new InfoCommand().declare(program);
    new ServeCommand().declare(program);
    program.parse(process.argv);
  }
}
github fabiospampinato / icon-font-buildr / src / bin.ts View on Github external
updateNotifier ({ pkg }).notify ();

  caporal
    .version ( pkg.version )
    .option ( '--config 
github fabiospampinato / cliflix / src / cli.ts View on Github external
updateNotifier ({ pkg }).notify ();

      args = _.castArray ( args.titleTorrent || [] ).concat ( args.webtorrentOptions );

      const doubleDashIndex = args.findIndex ( x => x === '--' ),
            hasWebtorrentOptions = ( doubleDashIndex >= 0 ),
            queryOrTorrent = hasWebtorrentOptions ? args.slice ( 0, doubleDashIndex ).join ( ' ' ) : args.join ( ' ' ),
            webtorrentOptions = hasWebtorrentOptions ? args.slice ( doubleDashIndex + 1 ) : [];

      if ( !queryOrTorrent ) return CLIFlix.wizard ( webtorrentOptions );

      return CLIFlix.lucky ( queryOrTorrent, webtorrentOptions );

    });

  caporal.parse ( process.argv );

}
github nestjs / nest-cli / index.js View on Github external
async function bootstrap () {
  const program = require('caporal');
  program
    .version(require('./package.json').version)
    .help('Nest.js CLI');
  require('./bin/create/command')(program);
  require('./bin/serve/command')(program);
  require('./bin/info/command')(program);
  require('./bin/generate/command')(program);
  require('./bin/update/command')(program);
  try {
    await configurationLoader.load();
  } catch (error) {
    process.stderr.write('[ WARN ] - Can\'t execute generate and serve commands since a project is not initialized\n');
  } finally {
    program.parse(process.argv);
  }
}
return bootstrap();
github ETCDEVTeam / emerald / index.js View on Github external
.action((args, options, logger) => {
    shell.cd(`${__dirname}/ethql`);
    shell.exec('npm run dev -- --jsonrpc=http://localhost:8545');
  })

  .command('deploy', 'Deploy solidity to network')
  .action((args, options, logger) => {
    migrate.run({working_directory: process.cwd()}, (err) => {
      if (err) {
        return logger.error(err);
      }
      logger.info('migrated');
    });
  })

prog.parse(process.argv);

caporal

A full-featured framework for building command line applications (cli) with node.js

MIT
Latest version published 4 years ago

Package Health Score

52 / 100
Full package analysis

Popular caporal functions