Skip to content

Commit fb6b050

Browse files
committed
feat: add schedule last days check
1 parent f0098c2 commit fb6b050

File tree

1 file changed

+9
-1
lines changed
  • src/commands/package/pushupgrade

1 file changed

+9
-1
lines changed

src/commands/package/pushupgrade/list.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,22 @@ export class PackagePushRequestListCommand extends SfCommand<PackagePushRequestL
5454
public async run(): Promise<PackagePushRequestListResultArr> {
5555
const { flags } = await this.parse(PackagePushRequestListCommand);
5656
this.connection = flags['target-dev-hub'].getConnection('61.0');
57+
const scheduledLastDays = flags['scheduled-last-days'];
58+
59+
// Check if scheduledLastDays is valid
60+
if (flags['scheduled-last-days'] !== undefined) {
61+
if (isNaN(scheduledLastDays!) || scheduledLastDays! <= 0) {
62+
throw new Error('Invalid value for --scheduled-last-days. It must be a positive integer.');
63+
}
64+
}
5765

5866
// Get results of query here
5967
// Use const since we will add verbose later
6068
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
6169
const results: PackagePushRequestListResult[] = await PackagePushUpgrade.list(this.connection, {
6270
packageId: flags.packageid,
6371
status: flags.status,
64-
scheduledLastDays: flags['scheduled-last-days'],
72+
scheduledLastDays,
6573
});
6674

6775
if (results.length === 0) {

0 commit comments

Comments
 (0)