How to use the cli-table function in cli-table

To help you get started, we’ve selected a few cli-table 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 alexklibisz / firebak / src / backup.js View on Github external
{'max request size (mb)': result.maxRequestSize / 1000000},
      {'total request size (mb)': result.totalRequestSize / 1000000},
      {'total objects (not counting nested)': result.totalObjects}
    );

    console.info(` >> Backup complete: ${backup.path}`);
    console.info(tableComplete.toString() + '\n\n');

    // Update aggregate sizes
    maxRequestSize = Math.max(maxRequestSize, result.maxRequestSize);
    totalRequestSize += result.totalRequestSize;
    totalObjects += result.totalObjects;
    totalDuration += (t2 - t1) / 1000;
  }

  const table = new Table();
  table.push(
    {'total duration (sec)': totalDuration },
    {'max request size (mb)': maxRequestSize / 1000000 },
    {'total request size (mb)': totalRequestSize / 1000000 },
    { 'total objects (not counting nested)': totalObjects }
  );
  console.info(' >> Backup complete: all collections');
  console.info(table.toString());
}
github oors / oors / packages / oors-logger / src / index.js View on Github external
printModules() {
    const modulesTable = new Table({
      head: ['Modules'],
    });

    this.manager.on('module:loaded', module => {
      modulesTable.push([module.name]);
    });

    this.manager.once('after:setup', () => {
      console.log(modulesTable.toString());
    });
  }
github dawson-org / dawson-cli / src / commands / describe.js View on Github external
title('Stack Resources');
        console.log(table.toString());
      }

      if (!shell) {
        log('');
      }

      const outputValues = Object.values(outputs);
      const sortedOutputs = sortBy(outputValues, ['OutputKey']);
      if (shell) {
        sortedOutputs.forEach(({ OutputKey, OutputValue }) => {
          process.stdout.write(`${OutputKey}=${OutputValue}\n`);
        });
      } else {
        const table = new Table({ head: ['OutputKey', 'OutputValue'] });
        table.push(
          ...sortedOutputs.map(({ OutputKey, OutputValue }) => [
            OutputKey,
            OutputValue
          ])
        );
        title('Stack Outputs');
        log(
          'Please do not copy-paste any OutputValue into your functions. These values are available from the params.stageVariables. in every lambda function.'.yellow.dim
        );
        console.log(table.toString());
      }
    })
    .catch(err => error('Command error', err));
github dawson-org / dawson-cli / src / libs / cloudformation.js View on Github external
.then(describeResult => {
          const failedEvents = describeResult.StackEvents
            .filter(e => e.Timestamp >= startTimestamp)
            .filter(e => e.ResourceStatus.includes('FAILED'))
            .map(e => [
              moment(e.Timestamp).fromNow(),
              e.ResourceStatus || '',
              e.ResourceStatusReason || '',
              e.LogicalResourceId || ''
            ]);
          const table = new Table({
            head: ['Timestamp', 'Status', 'Reason', 'Logical Id']
          });
          table.push(...failedEvents);
          if (describeResult.StackEvents[0]) {
            error();
          }
          done(createError({
            kind: 'Stack update failed',
            reason: 'The stack update has failed because of an error',
            detailedReason: (
                table.toString() +
                  '\n' +
                  chalk.gray(
                    oneLineTrim`
                You may further inspect stack events from the console at this link:
                https://${AWS_REGION}.console.aws.amazon.com/cloudformation/home
github aragon / aragon-cli / packages / cli / src / commands / apm_cmds / packages.js View on Github external
function displayPackages(packages) {
  const table = new Table({
    head: ['App', 'Latest Version'],
  })

  packages.forEach(aPackage => {
    const row = [aPackage.name, aPackage.version]
    table.push(row)
  })

  console.log('\n', table.toString())
}
github aragon / aragon-cli / packages / cli / src / commands / dao_cmds / apps.js View on Github external
const printPermissionlessApps = apps => {
  if (apps && apps.length) {
    const tableForPermissionlessApps = new Table({
      head: ['Permissionless app', 'Proxy address'].map(x => white(x)),
    })
    apps.forEach(app =>
      tableForPermissionlessApps.push([
        printAppNameFromAppId(app.appId).replace('.aragonpm.eth', ''),
        app.proxyAddress,
      ])
    )
    console.log(tableForPermissionlessApps.toString())
  }
}
github electrode-io / electrode-native / ern-core / src / compatibility.js View on Github external
export async function logCompatibilityReportTable (report: Object) {
  var table = new Table({
    head: [
      chalk.cyan('Name'),
      chalk.cyan('Needed Version'),
      chalk.cyan('Local Version')
    ],
    colWidths: [40, 16, 15]
  })

  for (const compatibleEntry of report.compatible) {
    table.push([
      compatibleEntry.dependencyName,
      chalk.green(compatibleEntry.remoteVersion ? compatibleEntry.remoteVersion : ''),
      chalk.green(compatibleEntry.localVersion ? compatibleEntry.localVersion : '')
    ])
  }
github LiferayCloud / magnet / src / routes.js View on Github external
export function getRoutesTable(magnet) {
  const table = new Table({
    head: ['method', 'path', 'type', 'file'],
    style: {
      border: ['gray'],
      compact: true,
      head: ['gray'],
    },
  });
  table.push(...getRoutesDefinition_(magnet));
  if (table.length) {
    return table.toString();
  }
  return '';
}
github SpoonX / stix / src / Library / Output / Output.ts View on Github external
public addHorizontalTable (head: string[], data: Array[], options: any = {}): this {
    const table = new Table({ head, ...options });

    table.push(...data);

    this.addData(table);

    return this;
  }
github rbardini / sro / src / formatters / table.js View on Github external
var formattedItems = _.reduce(items, (result, item) => {
      var header = '\n ' + chalk.bold(item.get('numero')) + '\n ' + item.countryName() + ' via ' + item.service()
      var table = new Table({
        head: ['Data', 'Local', 'Situação']
      })

      item.events().forEach((event) => {
        var data = moment(event.date()).format('lll')
        var local = `${event.get('local')} - ${event.get('cidade')}/${event.get('uf')}`
        var descricao = event.get('descricao')
        var destino = event.get('destino')

        if (destino) {
          local += `\nEm trânsito para ${destino.local} - ${destino.cidade}/${destino.uf}`
        }

        table.push([data, local, descricao])
      })

cli-table

Pretty unicode tables for the CLI

MIT
Latest version published 2 years ago

Package Health Score

76 / 100
Full package analysis