Protect what matters – even after you're gone. Make a plan for your digital legacy today.
Forum Discussion
flozza
9 months agoNew Contributor
Search for CLI
Hi!
I'd like to request a feature: For the 1Password CLI (`op`) to support searching, just like the GUI client does.
My use case: I have about 30 or so entries that I would like to add a tag to. All entries belong to the same domain "home.mydomain.com" (many have subdomains on it). In the GUI client I type "home.mydomain.com" and they all come up.
I want to use a script using the `op` CLI to edit each, adding a tag to them. Right now the only method I can find is to first list all items and then retrieve each and do the search myself. That's very slow. It would be great if I could send a search them off and get back a list of results.
This could be as simple as `op item search "home.mydomain.com" --format=json` and then I could edit each of those items.
Thanks!
5 Replies
- mckyNew Contributor
Too late for the op but maybe this is useful for someone else
If you have fzf installed, this one liner will search and then print the content
op item get (op item list | fzf --header-lines=1 | awk '{print $1}')- thecatfixDedicated Contributor
op item get $(op item list | fzf --header-lines=1 | awk '{print $1}')This is AWESOME
- thecatfixDedicated Contributor
op item get $(op item list --format json | jq -r '.[] | "\(.id) \(.title) [\(.vault.name)]"' | fzf | awk '{print $1}')For a cleaner selection interface that includes the Vault name and avoids parsing whitespace columns, use jq to format the entry before passing it to fzf.
- 1P_SimonH
Community Manager
- jakeNew Contributor
Although it may not exist in OP - have you considered using the API service? You can throw together a simple api handler in Python.
GET /v1/vaults/{vault_id}/items?filter=title contains "bank"
GET /v1/vaults/{vault_id}/items?filter=title eq "Amazon" and category eq "LOGIN"