@@ -130,6 +130,40 @@ describe("Command help output", () => {
130130 expect ( shortLine ! . indexOf ( "Short flag description" ) ) . toBe ( longLine ! . indexOf ( "Long flag description" ) )
131131 } ) . pipe ( Effect . provide ( TestLayer ) ) )
132132
133+ it . effect ( "aligns flag descriptions when flag names contain wide graphemes" , ( ) =>
134+ Effect . gen ( function * ( ) {
135+ const command = Command . make ( "tool" , {
136+ file : Flag . boolean ( "ファイル" ) . pipe ( Flag . withDescription ( "Wide flag description" ) ) ,
137+ emoji : Flag . boolean ( "👩💻" ) . pipe ( Flag . withDescription ( "Emoji flag description" ) ) ,
138+ verbose : Flag . boolean ( "verbose" ) . pipe ( Flag . withDescription ( "ASCII flag description" ) )
139+ } )
140+ const run = Command . runWith ( command , { version : "1.0.0" } )
141+
142+ yield * run ( [ "--help" ] )
143+
144+ const lines = ( yield * TestConsole . logLines ) . join ( "\n" ) . split ( "\n" )
145+ assert . include ( lines , " --ファイル Wide flag description" )
146+ assert . include ( lines , " --👩💻 Emoji flag description" )
147+ assert . include ( lines , " --verbose ASCII flag description" )
148+ } ) . pipe ( Effect . provide ( TestLayer ) ) )
149+
150+ it . effect ( "aligns flag descriptions when flag names contain zero-width code points" , ( ) =>
151+ Effect . gen ( function * ( ) {
152+ const command = Command . make ( "tool" , {
153+ combining : Flag . boolean ( "e\u0301" ) . pipe ( Flag . withDescription ( "Combining flag description" ) ) ,
154+ zeroWidth : Flag . boolean ( "a\u200Bb" ) . pipe ( Flag . withDescription ( "Zero-width flag description" ) ) ,
155+ ascii : Flag . boolean ( "abcd" ) . pipe ( Flag . withDescription ( "ASCII flag description" ) )
156+ } )
157+ const run = Command . runWith ( command , { version : "1.0.0" } )
158+
159+ yield * run ( [ "--help" ] )
160+
161+ const lines = ( yield * TestConsole . logLines ) . join ( "\n" ) . split ( "\n" )
162+ assert . include ( lines , " --e\u0301 Combining flag description" )
163+ assert . include ( lines , " --a\u200Bb Zero-width flag description" )
164+ assert . include ( lines , " --abcd ASCII flag description" )
165+ } ) . pipe ( Effect . provide ( TestLayer ) ) )
166+
133167 it . effect ( "separates long subcommand and argument names from their descriptions" , ( ) =>
134168 Effect . gen ( function * ( ) {
135169 const child = Command . make ( "account:set-password" , {
0 commit comments