src/utils/formatter.js
/**
	 * Format the output with table format
	 *
	 * @param {string} fields Table head, comma separated
	 * @param {Array} rows Rows of the data
	 */
Format the output with table format
@param {string} fields Table head, comma separated
@param {Array} rows Rows of the data
Format the output with table format @param { string } fields Table head comma separated @param { Array } rows Rows of the data
static toTable(fields, rows) {
		const table = new Table({
			head: fields.split(','),
			colWidths: fields.split(',').map((field) => columnWidth(field)),
			wordWrap: true,
		});
		const colWidths = fields.split(',').map((field) => columnWidth(field));
		rows.forEach(function (row) {
			row.forEach(function (rowField, index) {
				colWidths[index] = Math.min(
					Math.max(colWidths[index], rowField.toString().length + 5),
					80,
				);
			});
			table.push(row);
		});
		table.options.colWidths = colWidths;
		log.success(table.toString());
	}
static toTable ( fields , rows ) { const table = new Table ( { head : fields . split ( ',' ) , colWidths : fields . split ( ',' ) . map ( ( field ) => columnWidth ( field ) ) , wordWrap : true , } ) ; const colWidths = fields . split ( ',' ) . map ( ( field ) => columnWidth ( field ) ) ; rows . forEach ( function ( row ) { row . forEach ( function ( rowField , index ) { colWidths [ index ] = Math . min ( Math . max ( colWidths [ index ] , rowField . toString ( ) . length + 5 ) , 80 , ) ; } ) ; table . push ( row ) ; } ) ; table . options . colWidths = colWidths ; log . success ( table . toString ( ) ) ; }
Format the output with table format
 @param {string} fields Table head, comma separated
 @param {Array} rows Rows of the data
Format the output with table format @param { string } fields Table head comma separated @param { Array } rows Rows of the data