Skip to content

Commit

Permalink
fix: choices is overrided by the handler
Browse files Browse the repository at this point in the history
  • Loading branch information
npty committed Jul 29, 2024
1 parent 473521d commit 8aaa5cd
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions sui/deploy-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,19 @@ if (require.main === module) {
program
.name('deploy-contract')
.addArgument(
new Argument('<contractName>', 'Contract name to deploy')
.choices(supportedPackages.map((p) => p.packageName))
.argParser((packageName) => supportedPackages.find((p) => p.packageName === packageName)),
new Argument('<contractName>', 'Contract name to deploy').argParser((packageName) => {
const supportedPackage = supportedPackages.find((p) => p.packageName === packageName);

if (!supportedPackage) {
throw new Error(
`Unsupported package: ${packageName}. Supported packages: ${supportedPackages
.map((p) => p.packageName)
.join(', ')}`,
);
}

return supportedPackage;
}),
)
.description('Deploy SUI modules');

Expand Down

0 comments on commit 8aaa5cd

Please sign in to comment.