Skip to main content
Dec 14, 2021 2:04 PM UTC
Question

[33,34] Edit Multiple fields at once

I have a lot of fields to add/update in an exiting 1Password item, and I was wondering if I could to a "bulk" edit in someways ?

E.g. I am looking forward something like op item edit --template ...

I have not seen such option in the documentation. Is there a way to achieved that ?


1Password Version: 7.9.2
Extension Version: 2.0.0-beta.7
OS Version: macOS 11.6

7 replies

Dec 14, 2021 5:17 PM UTC

Right now, I am creating a (long) command string with all fields to set:


op item edit --vault myVault 'section1.field1[Text]=value1' 'section1.field2[Text]=value2' 'section1.field3[Text]=value3' ....

That's OK but still thinking the template option would give more flexibility :)

Dec 16, 2021 9:47 PM UTC

Hey @ebreton

Templates are currently not supported for op item edit, but we'll keep that in mind.

For the time being, what you are doing - a command with a bunch of field assignments is the only way to do it in the CLI.

Since you are already using assignment statements, would you have any feedback on them?

Dec 16, 2021 10:45 PM UTC

Hi @"Justin.Yoon_1P"

I like the syntax section.attribute[type]=value and I did not find any issues or edge cases so far.

I am sending python objects as strings. The only trick was to get them back as objects (at least for basic types) and the nice solution was to use ast.literal_eval on python side.

Dec 17, 2021 2:47 PM UTC

That's good to hear, thanks for the feedback!

Interesting that you are setting the values to python object strings (if I understand you correctly)!

Dec 18, 2021 3:40 AM UTC

I concur if there was a way to read from stdin or a file for the bulk updating of fields as well, it would be helpful. Being able to generate a json/yaml would be something I'd be interested in

Dec 19, 2021 2:59 PM UTC

Yes, you got it: simple python strings :)

It makes it easy to read (and use) on the 1Password apps, and it is straightforward to send (and parse)

Maybe at some point it will be JSON or something else... but no need for now

1Password Employee
Dec 31, 2021 2:11 PM UTC

Thank you both for your feedback @ebreton and @chrisgoffinet.

I agree both op item edit --template (which would work similarly to op item create --template) and piping a JSON template into op item edit add value and make a lot of sense. We should also add support for piping to op item create in my opinion.

I've tracked a ticket for us internally to add both of these. Thanks again for letting us know this will be useful for you 🙌