document
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.