()
| 38 | } |
| 39 | |
| 40 | private sendCommand(): Command { |
| 41 | return new Command("send") |
| 42 | .argument("<data>", "The data to Send. Specify as a filepath with the --file option") |
| 43 | .description( |
| 44 | "Work with Bitwarden sends. A Send can be quickly created using this command or subcommands can be used to fine-tune the Send", |
| 45 | ) |
| 46 | .option("-f, --file", "Specifies that <data> is a filepath") |
| 47 | .option( |
| 48 | "-d, --deleteInDays <days>", |
| 49 | "The number of days in the future to set deletion date, defaults to 7. If a particular deletion date is mandated by enterprise policy that value will override this flag.", |
| 50 | "7", |
| 51 | ) |
| 52 | .addOption( |
| 53 | new Option( |
| 54 | "--password <password>", |
| 55 | "optional password to access this Send. Can also be specified in JSON.", |
| 56 | ).conflicts("emails"), |
| 57 | ) |
| 58 | .addOption( |
| 59 | new Option( |
| 60 | "--emails <emails>", |
| 61 | "optional emails to access this Send. Can also be specified in JSON.", |
| 62 | ).argParser(parseEmail), |
| 63 | ) |
| 64 | .option("-a, --maxAccessCount <amount>", "The amount of max possible accesses.") |
| 65 | .option("--hidden", "Hide <data> in web by default. Valid only if --file is not set.") |
| 66 | .option( |
| 67 | "-n, --name <name>", |
| 68 | "The name of the Send. Defaults to a guid for text Sends and the filename for files.", |
| 69 | ) |
| 70 | .option("--notes <notes>", "Notes to add to the Send.") |
| 71 | .option( |
| 72 | "--fullObject", |
| 73 | "Specifies that the full Send object should be returned rather than just the access url.", |
| 74 | ) |
| 75 | .addCommand(this.listCommand()) |
| 76 | .addCommand(this.templateCommand()) |
| 77 | .addCommand(this.getCommand()) |
| 78 | .addCommand(this.receiveCommand()) |
| 79 | .addCommand(this.createCommand()) |
| 80 | .addCommand(this.editCommand()) |
| 81 | .addCommand(this.removePasswordCommand()) |
| 82 | .addCommand(this.deleteCommand()) |
| 83 | .action(async (data: string, options: OptionValues) => { |
| 84 | const encodedJson = this.makeSendJson(data, options); |
| 85 | |
| 86 | let response: Response; |
| 87 | if (encodedJson instanceof Response) { |
| 88 | response = encodedJson; |
| 89 | } else { |
| 90 | response = await this.runCreate(encodedJson, options); |
| 91 | } |
| 92 | |
| 93 | this.processResponse(response); |
| 94 | }); |
| 95 | } |
| 96 | |
| 97 | private receiveCommand(): Command { |
no test coverage detected