mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
fix: define options per command (#9733)
This commit is contained in:
parent
559dde78de
commit
8bae0545b7
@ -66,6 +66,17 @@ export class CLI {
|
||||
};
|
||||
},
|
||||
});
|
||||
yargs.option('platform', {
|
||||
type: 'string',
|
||||
desc: 'Platform that the binary needs to be compatible with.',
|
||||
choices: Object.values(BrowserPlatform),
|
||||
defaultDescription: 'Auto-detected by default.',
|
||||
});
|
||||
yargs.option('path', {
|
||||
type: 'string',
|
||||
desc: 'Path where the browsers will be downloaded to and installed from',
|
||||
default: process.cwd(),
|
||||
});
|
||||
},
|
||||
async argv => {
|
||||
const args = argv as unknown as InstallArgs;
|
||||
@ -93,17 +104,6 @@ export class CLI {
|
||||
);
|
||||
}
|
||||
)
|
||||
.option('path', {
|
||||
type: 'string',
|
||||
desc: 'Path where the browsers will be downloaded to and installed from',
|
||||
default: process.cwd(),
|
||||
})
|
||||
.option('platform', {
|
||||
type: 'string',
|
||||
desc: 'Platform that the binary needs to be compatible with.',
|
||||
choices: Object.values(BrowserPlatform),
|
||||
defaultDescription: 'Auto-detected by default.',
|
||||
})
|
||||
.command(
|
||||
'launch <browser>',
|
||||
'Launch the specified browser',
|
||||
@ -118,6 +118,22 @@ export class CLI {
|
||||
};
|
||||
},
|
||||
});
|
||||
yargs.option('detached', {
|
||||
type: 'boolean',
|
||||
desc: 'Whether to detach the child process.',
|
||||
default: false,
|
||||
});
|
||||
yargs.option('platform', {
|
||||
type: 'string',
|
||||
desc: 'Platform that the binary needs to be compatible with.',
|
||||
choices: Object.values(BrowserPlatform),
|
||||
defaultDescription: 'Auto-detected by default.',
|
||||
});
|
||||
yargs.option('path', {
|
||||
type: 'string',
|
||||
desc: 'Path where the browsers will be downloaded to and installed from',
|
||||
default: process.cwd(),
|
||||
});
|
||||
},
|
||||
async argv => {
|
||||
const args = argv as unknown as LaunchArgs;
|
||||
@ -133,22 +149,6 @@ export class CLI {
|
||||
});
|
||||
}
|
||||
)
|
||||
.option('path', {
|
||||
type: 'string',
|
||||
desc: 'Path where the browsers will be downloaded to and installed from',
|
||||
default: process.cwd(),
|
||||
})
|
||||
.option('detached', {
|
||||
type: 'boolean',
|
||||
desc: 'Whether to detach the child process.',
|
||||
default: false,
|
||||
})
|
||||
.option('platform', {
|
||||
type: 'string',
|
||||
desc: 'Platform that the binary needs to be compatible with.',
|
||||
choices: Object.values(BrowserPlatform),
|
||||
defaultDescription: 'Auto-detected by default.',
|
||||
})
|
||||
.demandCommand(1)
|
||||
.help()
|
||||
.parse();
|
||||
|
Loading…
Reference in New Issue
Block a user