MCPcopy Create free account
hub / github.com/bitwarden/clients / getCommand

Method getCommand

apps/cli/src/vault.program.ts:181–263  ·  view source on GitHub ↗
(useSharedFoldersTerm: boolean)

Source from the content-addressed store, hash-verified

179 }
180
181 private getCommand(useSharedFoldersTerm: boolean): Command {
182 const getObjects = [
183 "item",
184 "username",
185 "password",
186 "uri",
187 "totp",
188 "notes",
189 "exposed",
190 "attachment",
191 "folder",
192 "my-folder",
193 "collection",
194 "shared-folder",
195 "org-collection",
196 "org-shared-folder",
197 "organization",
198 "template",
199 "fingerprint",
200 "send",
201 ];
202 const shownObjects = this.visibleObjects(getObjects, useSharedFoldersTerm);
203 return new Command("get")
204 .argument("<object>", "Valid objects are: " + shownObjects.join(", "))
205 .argument("<id>", "Search term or object's globally unique `id`.")
206 .description("Get an object from the vault.")
207 .option("--itemid <itemid>", "Attachment's item id.")
208 .option("--output <output>", "Output directory or filename for attachment.")
209 .option("--organizationid <organizationid>", "Organization id for an organization object.")
210 .on("--help", () => {
211 writeLn("\n If raw output is specified and no output filename or directory is given for");
212 writeLn(" an attachment query, the attachment content is written to stdout.");
213 writeLn("");
214 writeLn(" Examples:");
215 writeLn("");
216 writeLn(" bw get item 99ee88d2-6046-4ea7-92c2-acac464b1412");
217 writeLn(" bw get password https://google.com");
218 writeLn(" bw get totp google.com");
219 writeLn(" bw get notes google.com");
220 writeLn(" bw get exposed yahoo.com");
221 writeLn(
222 " bw get attachment b857igwl1dzrs2 --itemid 99ee88d2-6046-4ea7-92c2-acac464b1412 " +
223 "--output ./photo.jpg",
224 );
225 writeLn(
226 " bw get attachment photo.jpg --itemid 99ee88d2-6046-4ea7-92c2-acac464b1412 --raw",
227 );
228 const personalFolderObject = useSharedFoldersTerm ? "my-folder" : "folder";
229 writeLn(` bw get ${personalFolderObject} email`);
230 writeLn(` bw get template ${personalFolderObject}`);
231 const folderObject = useSharedFoldersTerm ? "shared-folder" : "collection";
232 writeLn(` bw get ${folderObject} 6f1c2a3e-8d4b-4c57-9a10-2b7e5d9c4f38`);
233 writeLn(` bw get template ${folderObject}`);
234 writeLn("", true);
235 })
236 .action(async (object, id, cmd) => {
237 if (!this.validateObject(object, getObjects, shownObjects)) {
238 return;

Callers 1

registerMethod · 0.95

Calls 6

visibleObjectsMethod · 0.95
validateObjectMethod · 0.95
runMethod · 0.95
actionMethod · 0.80
descriptionMethod · 0.45
processResponseMethod · 0.45

Tested by

no test coverage detected