(useSharedFoldersTerm: boolean)
| 323 | } |
| 324 | |
| 325 | private editCommand(useSharedFoldersTerm: boolean): Command { |
| 326 | const editObjects = [ |
| 327 | "item", |
| 328 | "item-collections", |
| 329 | "item-shared-folders", |
| 330 | "folder", |
| 331 | "my-folder", |
| 332 | "org-collection", |
| 333 | "org-shared-folder", |
| 334 | ]; |
| 335 | const shownObjects = this.visibleObjects(editObjects, useSharedFoldersTerm); |
| 336 | return new Command("edit") |
| 337 | .argument("<object>", "Valid objects are: " + shownObjects.join(", ")) |
| 338 | .argument("<id>", "Object's globally unique `id`.") |
| 339 | .argument( |
| 340 | "[encodedJson]", |
| 341 | "Encoded json of the object to create. Can also be piped into stdin.", |
| 342 | ) |
| 343 | .description("Edit an object from the vault.") |
| 344 | .option("--organizationid <organizationid>", "Organization id for an organization object.") |
| 345 | .on("--help", () => { |
| 346 | writeLn("\n Examples:"); |
| 347 | writeLn(""); |
| 348 | const folderObject = useSharedFoldersTerm ? "my-folder" : "folder"; |
| 349 | writeLn( |
| 350 | ` bw edit ${folderObject} 5cdfbd80-d99f-409b-915b-f4c5d0241b02 eyJuYW1lIjoiTXkgRm9sZGVyMiJ9Cg==`, |
| 351 | ); |
| 352 | writeLn( |
| 353 | " echo 'eyJuYW1lIjoiTXkgRm9sZGVyMiJ9Cg==' | " + |
| 354 | `bw edit ${folderObject} 5cdfbd80-d99f-409b-915b-f4c5d0241b02`, |
| 355 | ); |
| 356 | writeLn( |
| 357 | ` bw edit ${useSharedFoldersTerm ? "item-shared-folders" : "item-collections"} ` + |
| 358 | "78307355-fd25-416b-88b8-b33fd0e88c82 " + |
| 359 | "WyI5NzQwNTNkMC0zYjMzLTRiOTgtODg2ZS1mZWNmNWM4ZGJhOTYiXQ==", |
| 360 | ); |
| 361 | writeLn("", true); |
| 362 | }) |
| 363 | .action(async (object, id, encodedJson, cmd) => { |
| 364 | if (!this.validateObject(object, editObjects, shownObjects)) { |
| 365 | return; |
| 366 | } |
| 367 | |
| 368 | await this.exitIfLocked(); |
| 369 | const command = new EditCommand( |
| 370 | this.serviceContainer.cipherService, |
| 371 | this.serviceContainer.folderService, |
| 372 | this.serviceContainer.keyService, |
| 373 | this.serviceContainer.encryptService, |
| 374 | this.serviceContainer.apiService, |
| 375 | this.serviceContainer.folderApiService, |
| 376 | this.serviceContainer.accountService, |
| 377 | this.serviceContainer.cliRestrictedItemTypesService, |
| 378 | this.serviceContainer.policyService, |
| 379 | this.serviceContainer.billingAccountProfileStateService, |
| 380 | this.serviceContainer.cipherAuthorizationService, |
| 381 | this.serviceContainer.configService, |
| 382 | ); |
no test coverage detected