How to use gauge - 6 common examples

To help you get started, we’ve selected a few gauge 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 antonycourtney / tad / src / csvimport.js View on Github external
return new Promise((resolve, reject) => {
    log.log('starting metascan...')
    const pathStats = fs.statSync(pathname)
    log.log('file size: ', pathStats.size)
    const msStart = process.hrtime()
    let firstRow = true
    var colTypes: Array
    let rowCount = 0
    // extract table name from file path:
    const tableName = genTableName(pathname)

    let csvOptions = { delimiter }
    const pathStream = fs.createReadStream(pathname)

    let gauge = new Gauge()

    const numREs = (delimiter === ';') ? eurNumREs : usNumREs
    const guessFunc = guessColumnType(numREs)

    gauge.show('scanning...', 0)
    let bytesRead = 0
    const countStream = through(function write (buf) {
      bytesRead += buf.length
      const pctComplete = bytesRead / pathStats.size
      const msg = 'scanning... ( ' + Math.round(pctComplete * 100) + '%)'
      gauge.show(msg, pctComplete)
      this.emit('data', buf)
    }, function end () {
      gauge.hide()
      log.log('countStream: bytesRead: ', bytesRead)
      this.emit('end')
github sanity-io / sanity / packages / @sanity / cli / src / actions / yarn / yarnWithProgress.js View on Github external
env: {PATH: [binDir, process.env.PATH].join(path.delimiter)}
    },
    options.execOpts || {}
  )

  const nodePath = process.argv[0]
  const nodeArgs = [yarnPath].concat(args, [
    '--json',
    '--non-interactive',
    '--ignore-engines',
    '--registry',
    'https://registry.npmjs.org'
  ])

  const state = {firstStepReceived: false, currentProgressStep: null}
  state.progress = new Gauge(process.stderr, {
    theme: 'colorASCII',
    enabled: true
  })

  // Yarn takes a while before starting to emit events, we want to show
  // some sort of indication while it's getting started
  onStep({data: {message: 'Resolving dependencies'}})
  onActivityStart({})

  const proc = execa(nodePath, nodeArgs, execOpts)
  proc.catch(onNativeError)

  // Will throw error async through the promise above
  if (!proc.stdout) {
    return proc
  }
github qooxdoo / qooxdoo-compiler / source / class / qx / tool / cli / commands / Compile.js View on Github external
qx.tool.compiler.Console.getInstance().setMachineReadable(true);
      } else {
        let configDb = await qx.tool.cli.ConfigDb.getInstance();
        let color = configDb.db("qx.default.color", null);
        if (color) {
          let colorOn = consoleControl.color(color.split(" "));
          process.stdout.write(colorOn + consoleControl.eraseLine());
          let colorReset = consoleControl.color("reset");
          process.on("exit", () => process.stdout.write(colorReset + consoleControl.eraseLine()));
          let Console = qx.tool.compiler.Console.getInstance();
          Console.setColorOn(colorOn);
        }

        if (this.argv["feedback"]) {
          var themes = require("gauge/themes");
          var ourTheme = themes.newTheme(themes({hasUnicode: true, hasColor: true}));
          let colorOn = qx.tool.compiler.Console.getInstance().getColorOn();
          ourTheme.preProgressbar = colorOn + ourTheme.preProgressbar;
          ourTheme.preSubsection = colorOn + ourTheme.preSubsection;
          ourTheme.progressbarTheme.postComplete += colorOn;
          ourTheme.progressbarTheme.postRemaining += colorOn;

          this.__gauge = new Gauge();
          this.__gauge.setTheme(ourTheme);
          this.__gauge.show("Compiling", 0);
          const TYPES = {
            "error": "ERROR",
            "warning": "Warning"
          };
          qx.tool.compiler.Console.getInstance().setWriter((str, msgId) => {
            msgId = qx.tool.compiler.Console.MESSAGE_IDS[msgId];
            if (msgId.type !== "message") {
github stevenvachon / broken-link-checker / lib / cli.js View on Github external
const run = () =>
{
	Object.values(gaugeThemes).forEach(theme =>
	{
		//theme.preProgressbar = `\n\n${theme.preProgressbar}`;
		theme.preSubsection = gray("—");
	});

	gauge = new Gauge();
	stats = new Statistics();

	if (logOptions.recursive)
	{
		checker = new SiteChecker(checkerOptions);
	}
	else
	{
		checker = new HtmlUrlChecker(checkerOptions);
	}

	checker
	.on(HTML_EVENT, (tree, robots, response, pageURL) =>
	{
		logPage(pageURL);
	})
github appcelerator / titanium_mobile / node_modules / sqlite3 / node_modules / node-pre-gyp / node_modules / npmlog / log.js View on Github external
log.disableUnicode = function () {
  gaugeTheme = Gauge.ascii
  log.gauge.setTheme(gaugeTheme)
}
github appcelerator / titanium_mobile / node_modules / sqlite3 / node_modules / node-pre-gyp / node_modules / npmlog / log.js View on Github external
log.enableUnicode = function () {
  gaugeTheme = Gauge.unicode
  log.gauge.setTheme(gaugeTheme)
}

gauge

A terminal based horizontal gauge

ISC
Latest version published 29 days ago

Package Health Score

64 / 100
Full package analysis