diff --git a/src/send.program.ts b/src/send.program.ts index 6a77135c8b..c4fe73dacf 100644 --- a/src/send.program.ts +++ b/src/send.program.ts @@ -170,15 +170,23 @@ export class SendProgram extends Program { .option('--text ', 'text to Send. Can also be specified in parent\'s JSON.') .option('--hidden', 'text hidden flag. Valid only with the --text option.') .option('--password ', 'optional password to access this Send. Can also be specified in JSON') - .option('--fullObject', 'Specifies that the full Send object should be returned rather than just the access url.') .on('--help', () => { writeLn(''); writeLn('Note:'); writeLn(' Options specified in JSON take precedence over command options'); writeLn('', true); }) - .action(async (encodedJson: string, options: program.OptionValues) => { - const response = await this.runCreate(encodedJson, options); + .action(async (encodedJson: string, options: program.OptionValues, args: { parent: program.Command }) => { + // Work-around to support `--fullObject` option for `send create --fullObject` + // Calling `option('--fullObject', ...)` above won't work due to Commander doesn't like same option + // to be defind on both parent-command and sub-command + const { fullObject = false } = args.parent.opts(); + const mergedOptions = { + ...options, + fullObject + }; + + const response = await this.runCreate(encodedJson, mergedOptions); this.processResponse(response); }); }