Protect what matters – even after you're gone. Make a plan for your digital legacy today.
Forum Discussion
XIII
4 years agoSuper Contributor
[53, 54] Can I use purpose or id in the item get --fields?
I want to have a safe way to extract the username (and password) from credentials using item get --fields:
https://developer.1password.com/docs/cli/reference/management-commands/item
Unfortunately it looks like I can only use label=username (or type=STRING, which won't help here)?
But what if I manually changed that label in the GUI?
I would prefer to use purpose=USERNAME (or id=username).
Is that possible? Or on the roadmap?
(I'd also like to have an easier way to get the current TOTP code; not requiring me to filter JSON output using jq)
1Password Version: CLI 2.0.0-beta.11
Extension Version: n/a
OS Version: n/a
4 Replies
- XIIISuper Contributor
Yes, that would help.
Suggestions are in my first post in this topic.
- Former Member
Oh, it seems that I misunderstood you here. My answer was related to editing items more granularly, while your question actually is related to filtering fields on different attributes.
While filtering onPURPOSEandIDis definitely on the roadmap, there are a couple of ways to achieve this in the current version of the CLI too.
For exampleop read op://<your-vault>/<your-item>/<your-field>accepts both names and IDs, whileop item get --fields <field-id>should be able to retrieve a field by UUID as well. However, this are only workarounds, and we are working towards developing a more user-friendly way to do this.
Does this help in your use case? Do you have any specific suggestions towards how you would like this functionality to be integrated in the CLI?Best,
Horia - XIIISuper Contributor
--otpworks great!I wish there was something similar for username/password, since labels are not safe.
I don't understand how templates play a role here?
(I only want to fetch username and password for this particular use case)
- Former Member
Hey XIII , and thank you for trying out our beta!
Being able to edit items more granularly is definitely on our roadmap. Currently, the way we envision this is by making use of template files, and allowing users to edit and pipe their jsons to
op item editdirectly, in the same fashionop item create --templateworks. Would this work for your use-case? Do you have any suggestions that would help you in your workflow?For the second part of the question: starting from
2.0.0-beta.10, the commandop item getfeatures a--otpflag, which has a behaviour similar to 1Password CLI 1'sop get totp. Let us know if this helps, or if you have any suggestions.Thanks for the input, and keep the feedback coming! We're here to listen and to help.
Best,
Horia