How to use the easy-table.print function in easy-table

To help you get started, we’ve selected a few easy-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 FlandreDaisuki / dmhy-subscribe / bin / command / list.js View on Github external
argv.SID.forEach((sid) => {
      const sub = db.find({ sid }); // bad use XD
      if (!sub) {
        print.error(l10n('CMD_LS_SID_NOT_FOUND', { sid }));
        process.exit(1);
      }
      const { title, keywords, unkeywords, episodeParser } = sub;
      const t = {};
      t[l10n('CMD_LS_CELL_SID')] = sid;
      t[l10n('CMD_LS_CELL_TITLE')] = title;
      t[l10n('CMD_LS_CELL_KEYWORDS')] = keywords.join(', ');
      t[l10n('CMD_LS_CELL_UNKEYWORDS')] = unkeywords.join(', ');
      t[l10n('CMD_LS_CELL_EPISODEPARSER')] = `${episodeParser}`;
      console.log(Table.print(t).trim());
      console.log();

      const tht = new Table();
      sub.threads.forEach((th) => {
        tht.cell(l10n('CMD_LS_CELL_THREAD_EPISODE'), th.episode.toString(TheEpisode.ascendCompare));
        tht.cell(l10n('CMD_LS_CELL_THREAD_TITLE'), th.title);
        tht.newRow();
      });
      console.log(tht.toString().trim());
      console.log();
    });
  } else {
github BolajiOlajide / koii / src / utils.js View on Github external
exports.formatRoutes = routes => { // eslint-disable-line
  return Table.print(routes, ({ method, path }, cell) => {
    for (const [attr, color, title] of [[method, 'green', 'METHOD'], [path, 'white', 'PATH']]) {
      cell(style(title, 'cyan'), style(attr, color)); // eslint-disable-line
    }
  });
};
github 3scale / 3scale-cli / lib / 3scale-cli.js View on Github external
_.each(options.table, function(item){ //flatten to an array without links
              var exclude = ["links"]
              if(_.isArray(options.excludes)){
                exclude.push(options.excludes)
              }

              items.push(_.omit(item[options.key],exclude))
            })
          }else{
            var exclude = ["links"]
            if(_.isArray(options.excludes)){
              exclude.push(options.excludes)
            }
            items.push(_.omit(options.table,exclude))
          }
          data = Table.print(items)
        }

        if(options.type == "success"){
          return console.log("[", "3scale-cli".white, "]", msg.green, data);
        }else if(options.type == "error"){
          return console.log("[", "3scale-cli".white, "]", msg.red, data);
        }else if(options.type == "info"){

        }else{
         return console.log("[", "3scale-cli".white, "]", msg.cyan, data);
        }
     } else {
         throw new Error("no message defined to print!");
     }
 }
github pszuster / 3ScaleTD / 3scale-Swagger-Import / lib / 3scale-cli.js View on Github external
_.each(options.table, function(item){ //flatten to an array without links
              var exclude = ["links"]
              if(_.isArray(options.excludes)){
                exclude.push(options.excludes)
              }

              items.push(_.omit(item[options.key],exclude))
            })
          }else{
            var exclude = ["links"]
            if(_.isArray(options.excludes)){
              exclude.push(options.excludes)
            }
            items.push(_.omit(options.table,exclude))
          }
          data = Table.print(items)
        }

        if(options.type == "success"){
          return console.log("[", "3scale-cli".white, "]", msg.green, data);
        }else if(options.type == "error"){
          return console.log("[", "3scale-cli".white, "]", msg.red, data);
        }else if(options.type == "info"){

        }else{
         return console.log("[", "3scale-cli".white, "]", msg.cyan, data);
        }
     } else {
         throw new Error("no message defined to print!");
     }
 }
github terascope / teraslice / packages / teraslice-cli / src / cmds / lib / display.ts View on Github external
async function text(headerValues: any, items: any) {
    const rows: any[] = [];
    _.each(items, (item) => {
        const row = {};
        _.each(headerValues, (headerValue) => {
            row[headerValue] = item[headerValue];
        });
        rows.push(row);
    });

    console.log(easyTable.print(rows));
}
github danielb2 / blipp / lib / index.js View on Github external
scope: internals.formatScope(show.scope),
            description: internals.formatDescription(show.description)
        };

        if (!options.showAuth) {
            delete row.auth;
        }

        if (!options.showScope) {
            delete row.scope;
        }

        out.push(row);
    });

    return Table.print(out);
};
github pwstegman / bci.js / lib / data / toTable.js View on Github external
function toTable(array) {
	return Table.print(array);
}
github hasankhan / sql-cli / lib / resultwriter.js View on Github external
writeRows(result) {
            result.forEach(this.formatItem.bind(this));
            this.log(Table.print(result));
        }
    }
github pwstegman / bci.js / lib / data / Matrix.js View on Github external
table(places = 5) {
		return Table.print(this.toFixed(places).array);
	}