Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ process.on('uncaughtException', (error) => {
process.exit(1)
})

// Long option aliases, rewritten to their canonical flag before parsing
const OPTION_ALIASES = new Map([
['--networks', '--network']
])

function mapAliases(argv: string[]): string[] {
return argv.map(arg => {
const [flag, ...value] = arg.split('=')
const canonical = OPTION_ALIASES.get(flag)
return canonical === undefined ? arg : [canonical, ...value].join('=')
})
}

async function main() {
try {
// Configure the main program
Expand All @@ -51,7 +64,7 @@ async function main() {
setupCommands(program)

// Parse arguments
await program.parseAsync(process.argv)
await program.parseAsync(mapAliases(process.argv))
} catch (error) {
deploymentEvents.emitEvent({
type: 'cli_error',
Expand Down
Loading