File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -116,9 +116,18 @@ export async function dispatchSubcommand(argv: string[]): Promise<boolean> {
116116async function main ( ) : Promise < void > {
117117 clack. intro ( 'create-pipedrive-app' ) ;
118118
119- const nameOrPath = await promptProjectName ( process . argv [ 2 ] ) ;
120- const database = await promptDatabase ( ) ;
121- const appExtensions = await promptAppExtensions ( ) ;
119+ let flags : ReturnType < typeof parseFlags > ;
120+ try {
121+ flags = parseFlags ( process . argv ) ;
122+ } catch ( error ) {
123+ clack . log . error ( error instanceof Error ? error . message : String ( error ) ) ;
124+ process . exit ( 1 ) ;
125+ }
126+
127+ const positional = process . argv [ 2 ] ?. startsWith ( '--' ) ? undefined : process . argv [ 2 ] ;
128+ const nameOrPath = flags . nameOrPath ?? ( await promptProjectName ( positional ) ) ;
129+ const database = flags . database ?? ( await promptDatabase ( ) ) ;
130+ const appExtensions = flags . appExtensions ?? ( await promptAppExtensions ( ) ) ;
122131
123132 const outputDir = resolve ( process . cwd ( ) , nameOrPath ) ;
124133 const projectName = basename ( outputDir ) ;
You can’t perform that action at this time.
0 commit comments