@@ -216,13 +216,13 @@ export class CLI {
216216 if ( Array . isArray ( cmd ?. options ) ) {
217217 const argv = this . argv ;
218218 const cargv = cmd . opts ( ) ;
219- this . debugLogger . trace ( `Copying ${ cmd . options . length } options...` ) ;
219+ this . debugLogger . trace ( `Copying ${ cmd . options . length } options... ( ${ cmd . name ( ) } ) ` ) ;
220220 for ( const o of cmd . options ) {
221221 let name = o . name ( ) ;
222222 if ( o . negate ) {
223223 name = name . replace ( / ^ n o - / , '' ) ;
224224 }
225- this . debugLogger . trace ( ` Setting ${ name } = ${ cargv [ o . attributeName ( ) ] } ` ) ;
225+ this . debugLogger . trace ( ` Setting ${ name } = ${ cargv [ o . attributeName ( ) ] } (prev: ${ argv [ name ] } ) ` ) ;
226226 argv [ name ] = cargv [ o . attributeName ( ) ] ;
227227 }
228228 }
@@ -550,6 +550,15 @@ export class CLI {
550550 const { conf, optionBranches } = cmd ;
551551 const cmdName = cmd . name ( ) ;
552552
553+ // this is a hack... `-d` now conflicts between `--workspace-dir` and
554+ // the now global `--project-dir` option causing `--project-dir` to
555+ // snipe `--workspace-dir`, so we treat them the same for the `create`
556+ // command
557+ if ( cmdName === 'create' && ! this . argv [ 'workspace-dir' ] && this . argv [ 'project-dir' ] ) {
558+ cmd . setOptionValue ( 'workspaceDir' , expand ( this . argv [ 'project-dir' ] ) ) ;
559+ this . argv [ 'project-dir' ] = undefined ;
560+ }
561+
553562 if ( optionBranches ?. length ) {
554563 this . debugLogger . trace ( `Processing missing option branches: ${ optionBranches . join ( ', ' ) } ` ) ;
555564
@@ -774,7 +783,10 @@ export class CLI {
774783
775784 // if `--project-dir` was not set, default to the current working directory
776785 const cwd = expand ( this . argv [ 'project-dir' ] || '.' ) ;
777- this . argv [ 'project-dir' ] = cwd ;
786+ if ( cmdName !== 'create' ) {
787+ // create command doesn't have a --project-dir option
788+ this . argv [ 'project-dir' ] = cwd ;
789+ }
778790
779791 // load hooks
780792 const hooks = ticonfig . paths ?. hooks ;
@@ -1302,14 +1314,6 @@ export class CLI {
13021314
13031315 this . debugLogger . trace ( 'Checking for missing/invalid options:' , orderedOptionNames ) ;
13041316
1305- // this is a hack... `-d` now conflicts between `--workspace-dir` and
1306- // the now global `--project-dir` option causing `--project-dir` to
1307- // snipe `--workspace-dir`, so we treat them the same for the `create`
1308- // command
1309- if ( this . command . name ( ) === 'create' && ! this . argv [ 'workspace-dir' ] ) {
1310- this . argv [ 'workspace-dir' ] = this . argv [ 'project-dir' ] ;
1311- }
1312-
13131317 // this while loop is essentially a pump that processes missing/invalid
13141318 // options one at a time, recalculating them each iteration
13151319 // eslint-disable-next-line no-constant-condition
0 commit comments