File tree Expand file tree Collapse file tree 2 files changed +19
-13
lines changed
Expand file tree Collapse file tree 2 files changed +19
-13
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ import {
1616 mdTableHeader ,
1717 renderInlineMarkdown ,
1818 renderMarkdown ,
19- stripColorTags ,
19+ stripMarkdownInline ,
2020} from "./markdown.js" ;
2121import {
2222 renderTextTable ,
@@ -174,13 +174,17 @@ export function formatLogsHeader(): string {
174174 * @returns Rendered terminal string with Unicode-bordered table
175175 */
176176export function formatLogTable ( logs : LogLike [ ] , includeTrace = true ) : string {
177+ const headers = [ ...LOG_TABLE_COLS ] ;
178+
177179 if ( isPlainOutput ( ) ) {
178- const rows = logs
179- . map ( ( log ) => mdRow ( buildLogRowCells ( log , false , includeTrace ) ) . trimEnd ( ) )
180- . join ( "\n" ) ;
181- return `${ stripColorTags ( mdTableHeader ( LOG_TABLE_COLS ) ) } \n${ rows } \n` ;
180+ const rows = logs . map ( ( log ) =>
181+ buildLogRowCells ( log , false , includeTrace ) . map ( ( c ) =>
182+ stripMarkdownInline ( c )
183+ )
184+ ) ;
185+ return renderTextTable ( headers , rows ) ;
182186 }
183- const headers = [ ... LOG_TABLE_COLS ] ;
187+
184188 const rows = logs . map ( ( log ) =>
185189 buildLogRowCells ( log , false , includeTrace ) . map ( ( c ) =>
186190 renderInlineMarkdown ( c )
Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ import {
2020 mdTableHeader ,
2121 renderInlineMarkdown ,
2222 renderMarkdown ,
23- stripColorTags ,
23+ stripMarkdownInline ,
2424} from "./markdown.js" ;
2525import { type Column , formatTable } from "./table.js" ;
2626import { renderTextTable } from "./text-table.js" ;
@@ -119,15 +119,17 @@ export function formatTracesHeader(): string {
119119 * @returns Rendered terminal string with Unicode-bordered table
120120 */
121121export function formatTraceTable ( items : TransactionListItem [ ] ) : string {
122- if ( isPlainOutput ( ) ) {
123- const rows = items
124- . map ( ( item ) => mdRow ( buildTraceRowCells ( item ) ) . trimEnd ( ) )
125- . join ( "\n" ) ;
126- return `${ stripColorTags ( mdTableHeader ( TRACE_TABLE_COLS ) ) } \n${ rows } \n` ;
127- }
128122 const headers = TRACE_TABLE_COLS . map ( ( c ) =>
129123 c . endsWith ( ":" ) ? c . slice ( 0 , - 1 ) : c
130124 ) ;
125+
126+ if ( isPlainOutput ( ) ) {
127+ const rows = items . map ( ( item ) =>
128+ buildTraceRowCells ( item ) . map ( ( c ) => stripMarkdownInline ( c ) )
129+ ) ;
130+ return renderTextTable ( headers , rows ) ;
131+ }
132+
131133 const rows = items . map ( ( item ) =>
132134 buildTraceRowCells ( item ) . map ( ( c ) => renderInlineMarkdown ( c ) )
133135 ) ;
You can’t perform that action at this time.
0 commit comments