MCPcopy Create free account
hub / github.com/PicoCreator/smol-dev-js / standardTableHeader

Method standardTableHeader

src/cli/OutputHandler.js:611–640  ·  view source on GitHub ↗

* Standard output log, in a header format * * This is enabled if either standard, or table mode is enabled * * @param {Array } headerArray containing header names * @param {Array } widthArray

(headerArray, widthArray = [])

Source from the content-addressed store, hash-verified

609 * @param {Array<Int>} widthArray
610 */
611 standardTableHeader(headerArray, widthArray = []) {
612 // Does nothing if not enabled
613 if(!(this.stdOutput || this.tableOutput)) {
614 return;
615 }
616
617 // Does the header line first
618 this.standardTableRow(headerArray, widthArray);
619
620 // Does the dash line
621 let headerLine = "";
622 for(let k=0; k<headerArray.length; ++k) {
623 // Lets add the end padding
624 if( k>0 ) {
625 headerLine += " ";
626 }
627
628 // Handle length
629 let collumnLength = widthArray[k];
630 if( collumnLength < 0 ) {
631 collumnLength = headerArray[k].length;
632 }
633
634 // Row and lines text handling
635 headerLine += dashLineString(collumnLength);
636 }
637
638 // Output the dash line
639 console.log( headerLine );
640 }
641
642 /**
643 * Standard output log, in a row format, this is used together with standardHeader

Callers 1

tableHeaderMethod · 0.95

Calls 2

standardTableRowMethod · 0.95
dashLineStringFunction · 0.85

Tested by

no test coverage detected