src/utils/formatter.js
/**
	 * Format the output with table format
	 *
	 * @param {string} fields Label, comma separated
	 * @param {Array} rows Rows of the data
	 */
Format the output with table format
@param {string} fields Label, comma separated
@param {Array} rows Rows of the data
Format the output with table format @param { string } fields Label comma separated @param { Array } rows Rows of the data
static toList(fields, rows) {
		const table = new Table({
			head: ['Field', 'Value'],
			wordWrap: true,
		});
		const labels = fields.split(',');
		const colWidths = [20, 20];
		const results = rows.flat(1);
		labels.forEach(function (label, i) {
			const row = {};
			row[label] = results[i];
			table.push(row);
			colWidths[0] = Math.max(colWidths[0], label.length + 5);
			colWidths[1] =
				typeof results[i] === 'string'
					? Math.min(Math.max(colWidths[1], results[i].length + 5), 100) 
					: colWidths[1];
		});
		table.options.colWidths = colWidths;
		log.success(table.toString());
	}
static toList ( fields , rows ) { const table = new Table ( { head : [ 'Field' , 'Value' ] , wordWrap : true , } ) ; const labels = fields . split ( ',' ) ; const colWidths = [ 20 , 20 ] ; const results = rows . flat ( 1 ) ; labels . forEach ( function ( label , i ) { const row = { } ; row [ label ] = results [ i ] ; table . push ( row ) ; colWidths [ 0 ] = Math . max ( colWidths [ 0 ] , label . length + 5 ) ; colWidths [ 1 ] = typeof results [ i ] === 'string' ? Math . min ( Math . max ( colWidths [ 1 ] , results [ i ] . length + 5 ) , 100 ) : colWidths [ 1 ] ; } ) ; table . options . colWidths = colWidths ; log . success ( table . toString ( ) ) ; }
Format the output with table format
 @param {string} fields Label, comma separated
 @param {Array} rows Rows of the data
Format the output with table format @param { string } fields Label comma separated @param { Array } rows Rows of the data
// Count column width // Lock to max 100