File tree Expand file tree Collapse file tree 1 file changed +11
-12
lines changed
packages/cloudflare/src/cli Expand file tree Collapse file tree 1 file changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -87,22 +87,21 @@ export function getArgs(): Arguments {
87
87
export function getPassthroughArgs < T extends ParseArgsConfig > ( args : string [ ] , { options = { } } : T ) {
88
88
const passthroughArgs : string [ ] = [ ] ;
89
89
90
- args . forEach ( ( fullArg , idx ) => {
91
- const [ , name ] = / ^ - - ? ( \w [ \w - _ ] * ) ( = .+ ) ? $ / . exec ( fullArg ) ?? [ ] ;
92
- if ( name && ! ( name in options ) ) {
93
- passthroughArgs . push ( fullArg ) ;
90
+ for ( let i = 0 ; i < args . length ; i ++ ) {
91
+ if ( args [ i ] === "--" ) {
92
+ passthroughArgs . push ( ...args . slice ( i + 1 ) ) ;
93
+ return passthroughArgs ;
94
+ }
94
95
95
- for ( let i = idx + 1 ; i < args . length ; i ++ ) {
96
- const arg = args [ i ] ;
96
+ const [ , name ] = / ^ - - ? ( \w [ \w - _ ] * ) ( = .+ ) ? $ / . exec ( args [ i ] ! ) ?? [ ] ;
97
+ if ( name && ! ( name in options ) ) {
98
+ passthroughArgs . push ( args [ i ] ! ) ;
97
99
98
- if ( ! arg || arg . startsWith ( "-" ) ) {
99
- break ;
100
- } else {
101
- passthroughArgs . push ( arg ) ;
102
- }
100
+ while ( ! args [ i + 1 ] ?. startsWith ( "-" ) ) {
101
+ passthroughArgs . push ( args [ ++ i ] ! ) ;
103
102
}
104
103
}
105
- } ) ;
104
+ }
106
105
107
106
return passthroughArgs ;
108
107
}
You can’t perform that action at this time.
0 commit comments