()
| 207 | } |
| 208 | |
| 209 | private createCommand(): Command { |
| 210 | return new Command("create") |
| 211 | .argument("[encodedJson]", "JSON object to upload. Can also be piped in through stdin.") |
| 212 | .description("create a Send") |
| 213 | .option("--file <path>", "file to Send. Can also be specified in parent's JSON.") |
| 214 | .option("--text <text>", "text to Send. Can also be specified in parent's JSON.") |
| 215 | .option("--hidden", "text hidden flag. Valid only with the --text option.") |
| 216 | .on("--help", () => { |
| 217 | writeLn(""); |
| 218 | writeLn("Note:"); |
| 219 | writeLn(" Options specified in JSON take precedence over command options"); |
| 220 | writeLn("", true); |
| 221 | }) |
| 222 | .action(async (encodedJson: string, options: OptionValues, args: { parent: Command }) => { |
| 223 | // subcommands inherit flags from their parent; they cannot override them |
| 224 | const { fullObject = false, emails = undefined, password = undefined } = args.parent.opts(); |
| 225 | |
| 226 | const mergedOptions = { |
| 227 | ...options, |
| 228 | fullObject: fullObject, |
| 229 | emails, |
| 230 | password, |
| 231 | }; |
| 232 | |
| 233 | const response = await this.runCreate(encodedJson, mergedOptions); |
| 234 | this.processResponse(response); |
| 235 | }); |
| 236 | } |
| 237 | |
| 238 | private editCommand(): Command { |
| 239 | return new Command("edit") |
no test coverage detected