document
Perform CRUD operations on Document items in your vaults.
Subcommandsโ
- document create: Create a document item
- document delete: Delete or archive a document item
- document edit: Edit a document item
- document get: Download a document
- document list: Get a list of documents
document createโ
Create a document item and receive a JSON object that contains the item's ID.
Flagsโ
By default, the document is saved in your built-in Personal, Private, or Employee vault. Specify a different vault with the --vault
option.
Create a file from standard inputโ
To create the file contents from standard input (stdin), enter a
hyphen (-
) instead of a path. You can use the --file-name
option to
change the name of the file.
Examplesโ
Create a document by specifying the file path:
Create a document from standard input:
document deleteโ
Permanently delete a document. Specify the document to delete by its name or ID.
Use the --archive
option to move it to the Archive instead.
Flagsโ
Specify items on standard inputโ
The command treats each line of information on standard input (stdin) as
an object specifier. Run op help
to learn more about how to specify
objects.
You can also input a list or array of JSON objects. The command will
get an item for any object that has an ID. This is useful for
passing information from one op
command to another.
Examplesโ
Permanently delete a document:
Move a document to the Archive:
document editโ
Edit a document item. Specify the document item to edit by its name or ID.
Flagsโ
Replaces the file contents of a Document item with the provided file or with the information on standard input (stdin).
Update a file from standard inputโ
To update the file contents from standard input (stdin), enter a
hyphen (-
) instead of a path. You can use the --file-name
option to
change the name of the file.
document getโ
Download a document and print the contents. Specify the document by its name or ID.
Flagsโ
Prints to standard output (stdout) by default. To print to a file, use the
--out-file path/to/file.ext
flag.
Save to a fileโ
Use the --out-file
option to have op
save the document. This may
be useful in some shells as a way to preserve the file's original
encoding.
The --out-file
option won't overwrite an existing file. The
destination path must be an empty file or not exist.
Examplesโ
Save a document to a file called secret-plans.text
:
document listโ
List documents.
Flagsโ
Returns a list of all documents the account has read access to by default. Excludes items in the Archive by default.