How to use yargonaut - 10 common examples

To help you get started, we’ve selected a few yargonaut 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 lando / lando / lib / cli.js View on Github external
run(tasks = [], config = {}) {
    const yargonaut = require('yargonaut');
    yargonaut.style('green').errorsStyle('red');
    const yargs = require('yargs');

    // Clear any task caches we have
    if (yargs.argv.clear) {
      if (fs.existsSync(process.landoTaskCacheFile)) fs.unlinkSync(process.landoTaskCacheFile);
      if (fs.existsSync(process.landoAppTaskCacheFile)) fs.unlinkSync(process.landoAppTaskCacheFile);
      console.log('Lando has cleared the tasks cache!');
      process.exit(0);
    }

    // Start up the CLI
    const cmd = !_.has(process, 'pkg') ? '$0' : path.basename(_.get(process, 'execPath', 'lando'));
    yargs.usage(`Usage: ${cmd}  [args] [options]`)
      .demandCommand(1, 'You need at least one command before moving on')
      .example('lando start', 'Run lando start')
      .example('lando rebuild --help', 'Get help about using the lando rebuild command')
github eden-js / cli / core / cli / core.js View on Github external
// require dependencies
const fs = require('fs-extra');
const path = require('path');
const chalk = require('chalk');
const Events = require('events');
const yargonaut = require('yargonaut'); // Must precede yargs
const prettyTime = require('pretty-hrtime');
const extractComments = require('extract-comments');

// initialization logic
const initEden = require('lib/utilities/init');
const packageJSON = require('../../package.json');

// Set yargs colors
yargonaut
  .style('underline.green')
  .errorsStyle('red');

/**
 * create eden generator class
 *
 * @extends Events
 */
class EdenCore extends Events {
  /**
   * construct eden generator
   */
  constructor() {
    // run super
    // eslint-disable-next-line prefer-rest-params
    super(...arguments);
github scalarwaves / iloa / src / iloa.js View on Github external
#!/usr/bin/env node
/* eslint-disablemax-len: 0, no-unused-expressions: 0 */
const chalk = require('chalk')
const pkg = require('../package.json')
const yargonaut = require('yargonaut')
  .style('bold.underline', 'Commands:')
  .style('bold.underline', 'Options:')
  .style('bold.cyan', 'boolean')
  .style('bold.yellow', 'string')
  .style('bold.magenta', 'number')
  .style('bold.blue', 'default:')
  .style('bold.green', 'aliases:')
const yargs = require('yargs')
yargs
  .commandDir('commands')
  .usage(`${chalk.yellow(`${yargonaut.asFont('iloa', 'Small Slant')}`)}\n${chalk.bold.underline('Usage:')}\n$0  [options]`)
  .help('h')
  .alias('h', 'help')
  .option('v', {
    alias: 'verbose',
    type: 'boolean',
github scalarwaves / leximaven / src / leximaven.js View on Github external
#!/usr/bin/env node
/* eslint max-len: 0, no-unused-expressions: 0 */
const chalk = require('chalk')
const pkg = require('../package.json')
const yargonaut = require('yargonaut')
  .style('bold.underline', 'Commands:')
  .style('bold.underline', 'Options:')
  .style('bold.cyan', 'boolean')
  .style('bold.yellow', 'string')
  .style('bold.magenta', 'number')
  .style('bold.blue', 'default:')
  .style('bold.green', 'aliases:')
const yargs = require('yargs')
yargs
  .commandDir('commands')
  .usage(`${chalk.yellow(`${yargonaut.asFont('leximaven', 'Small Slant')}`)}\n${chalk.bold.underline('Usage:')}\n$0  [options]`)
  .help('h')
  .alias('h', 'help')
  .option('v', {
    alias: 'verbose',
    type: 'boolean',
github lando / lando / lib / art.js View on Github external
'use strict';

// Modules
const _ = require('lodash');
const chalk = require('yargonaut').chalk();
const os = require('os');

// Art data
const art = {
  error: [
    chalk.red('Lando has crashed!!!'),
    '',
    'Would you like to report it, and subsequent errors, to Lando?',
    '',
    'This data is only used by the Lando team to ensure the application runs as well as it can.',
    chalk.green('For more details check out https://docs.lando.dev/privacy/'),
  ],
  init: [
    chalk.green('NOW WE\'RE COOKING WITH FIRE!!!'),
    'Your app has been initialized!',
    '',
github lando / lando / plugins / lando-app / lib / utils.js View on Github external
'use strict';

// Modules
const _ = require('lodash');
const chalk = require('yargonaut').chalk();
const fs = require('fs-extra');
const path = require('path');
const url = require('url');

/*
 * Checks if there is already an app with the same name in an app _registry
 * object
 */
exports.appNameExists = (apps, app) => _.some(apps, a => a.name === app.name);

/*
 * Validates compose files returns legit ones
 */
exports.validateFiles = (files, root) => {
  // Handle args
  if (typeof files === 'string') {
github lando / lando / lib / node.js View on Github external
* // Get the lodash module
 * var _ = lando.node._;
 */
exports._ = require('lodash');

/**
 * Get chalk
 *
 * @since 3.0.0
 * @alias 'lando.node.chalk'
 * @example
 *
 * // Get the chalk module
 * var chalk = lando.node.chalk;
 */
exports.chalk = require('yargonaut').chalk();

/**
 * Get fs-extra
 *
 * @since 3.0.0
 * @alias 'lando.node.fs'
 * @example
 *
 * // Get the fs-extra module
 * var fs = lando.node.fs;
 */
exports.fs = require('fs-extra');

/**
 * Get object-hash
 *
github wildbit / postmark-cli / src / index.ts View on Github external
#!/usr/bin/env node

import chalk from 'chalk'

require('yargonaut')
  .style('yellow')
  .errorsStyle('red')

require('yargs')
  .env('POSTMARK')
  .commandDir('commands')
  .demandCommand()
  .help()
  .usage(
    chalk.yellow(`
              ____           _                        _    
 _________   |  _ \\ ___  ___| |_ _ __ ___   __ _ _ __| | __
| \\     / |  | |_) / _ \\/ __| __| '_ ' _ \\ / _\` | '__| |/ /
|  '...'  |  |  __/ (_) \\__ \\ |_| | | | | | (_| | |  |   < 
|__/___\\__|  |_|   \\___/|___/\\__|_| |_| |_|\\__,_|_|  |_|\\_\\`)
  ).argv
github imodeljs / imodeljs / tools / webpack / bin / bentley-webpack-tools.js View on Github external
#!/usr/bin/env node

/*---------------------------------------------------------------------------------------------
* Copyright (c) 2019 Bentley Systems, Incorporated. All rights reserved.
* Licensed under the MIT License. See LICENSE.md in the project root for license terms.
*--------------------------------------------------------------------------------------------*/

"use strict";

require('yargonaut')
  .style('green')
  .style('yellow', "required")
  .style('cyan', "Positionals:")
  .helpStyle('cyan')
  .errorsStyle('red.bold');

const chalk = require("chalk");
const yargs = require("yargs");
const argv = yargs
  .wrap(Math.min(120, yargs.terminalWidth()))
  .usage(`\n${chalk.bold("$0")} ${chalk.yellow("")}`)
  .command(require("../scripts/start"))
  .command(require("../scripts/start-backend"))
  .command(require("../scripts/start-frontend"))
  .command(require("../scripts/test"))
  .command(require("../scripts/test-e2e"))
github rxstack / rxstack / packages / core / src / console / command-manager.ts View on Github external
execute(): void {
    require('yargonaut')
      .style('blue')
      .style('yellow', 'required')
      .helpStyle('green')
      .errorsStyle('red')
    ;

    cli.usage(`Usage: $0  [options]`);
    this.commands.forEach((command) => {
      cli.command(command);
    });

    cli.demandCommand(1)
      .strict()
      .alias('v', 'version')
      .help('h')
      .alias('h', 'help')

yargonaut

Decorate yargs content with chalk styles and figlet fonts

Apache-2.0
Latest version published 6 years ago

Package Health Score

47 / 100
Full package analysis