11import z from 'zod'
2- import { format , StringStyle , stripColors } from './color '
2+ import { format , StringStyle , stripStyle } from './style '
33import { MassargCommand } from './command'
44import { DeepRequired , strConcat , indent } from './utils'
55
@@ -242,7 +242,7 @@ export class HelpGenerator {
242242}
243243
244244function wrap ( text : string , maxRowLength : number ) : string {
245- const length = stripColors ( text ) . length
245+ const length = stripStyle ( text ) . length
246246 if ( length <= maxRowLength ) {
247247 return text
248248 }
@@ -251,7 +251,7 @@ function wrap(text: string, maxRowLength: number): string {
251251 let currentRow = ''
252252
253253 for ( const word of words ) {
254- if ( stripColors ( currentRow ) . length + stripColors ( word ) . length + 1 > maxRowLength ) {
254+ if ( stripStyle ( currentRow ) . length + stripStyle ( word ) . length + 1 > maxRowLength ) {
255255 subRows . push ( currentRow )
256256 currentRow = ''
257257 }
@@ -288,7 +288,7 @@ function generateHelpTable<T extends Partial<GenerateTableCommandConfig>>(
288288 const table = rows . map ( ( row ) => {
289289 const name = nameStyle ( row . name . padEnd ( maxNameLength + 2 ) )
290290 const description = descStyle ( row . description )
291- const length = stripColors ( name ) . length + stripColors ( description ) . length
291+ const length = stripStyle ( name ) . length + stripStyle ( description ) . length
292292 if ( length <= maxRowLength ) {
293293 const line = `${ name } ${ description } `
294294 if ( ! compact ) {
@@ -301,7 +301,7 @@ function generateHelpTable<T extends Partial<GenerateTableCommandConfig>>(
301301 let currentRow = name
302302
303303 for ( const word of words ) {
304- if ( stripColors ( currentRow ) . length + stripColors ( word ) . length + 1 > maxRowLength ) {
304+ if ( stripStyle ( currentRow ) . length + stripStyle ( word ) . length + 1 > maxRowLength ) {
305305 subRows . push ( currentRow )
306306 currentRow = ' ' . repeat ( maxNameLength + 2 )
307307 }
0 commit comments