How to use the gauge function in gauge

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 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);
	})

gauge

A terminal based horizontal gauge

ISC
Latest version published 12 months ago

Package Health Score

85 / 100
Full package analysis