@@ -238,6 +238,32 @@ test('non-primitive option union', async () => {
238238 )
239239} )
240240
241+ test ( 'positional array with title' , async ( ) => {
242+ const router = t . router ( {
243+ foo : t . procedure
244+ . input ( z . array ( z . string ( ) ) . describe ( 'files' ) ) //
245+ . query ( ( { input} ) => JSON . stringify ( input ) ) ,
246+ bar : t . procedure
247+ . input ( z . array ( z . string ( ) . describe ( 'files' ) ) ) //
248+ . query ( ( { input} ) => JSON . stringify ( input ) ) ,
249+ baz : t . procedure
250+ . input ( z . array ( z . string ( ) . describe ( 'one single file' ) ) . describe ( 'file collection' ) )
251+ . query ( ( { input} ) => JSON . stringify ( input ) ) ,
252+ } )
253+
254+ const cli = createCli ( { router} )
255+ expect ( await output ( cli , [ 'foo' , 'abc' , 'def' ] ) ) . toMatchInlineSnapshot ( `"["abc","def"]"` )
256+ expect ( ( await output ( cli , [ 'foo' , '--help' ] ) ) . split ( '\n' ) [ 0 ] ) . toMatchInlineSnapshot (
257+ `"Usage: program foo [options] <files...>"` ,
258+ )
259+ expect ( ( await output ( cli , [ 'bar' , '--help' ] ) ) . split ( '\n' ) [ 0 ] ) . toMatchInlineSnapshot (
260+ `"Usage: program bar [options] <files...>"` ,
261+ )
262+ expect ( ( await output ( cli , [ 'baz' , '--help' ] ) ) . split ( '\n' ) [ 0 ] ) . toMatchInlineSnapshot (
263+ `"Usage: program baz [options] <file collection...>"` ,
264+ )
265+ } )
266+
241267const run = async ( cli : TrpcCli , argv : string [ ] ) => {
242268 const exit = vi . fn ( ) as any
243269 const log = vi . fn ( )
0 commit comments