Can `op edit` add or change values in an array?

P1h3r1e3d13
P1h3r1e3d13
Community Member

I'd like to script the addition of websites to the URLs list of some login items. (I'm coming from LastPass, where I had a lot of equivalent domains defined.) So I have an item like this (abridged):

$ op get item kd7bhqzz7vojq3emrkejmqrr7m | jq
{
  "uuid": "kd7bhqzz7vojq3emrkejmqrr7m",
  ...
  "overview": {
    "URLs": [
      {
        "l": "website",
        "u": "https://example.com"
      },
      {
        "l": "website 2",
        "u": "https://foobar.com"
      }
    ],
    ...
    "url": "https://example.com"
  }
}

And I've tried things like:

$ op edit item kd7bhqzz7vojq3emrkejmqrr7m URLs.1.u='blahblah'
$ op edit item kd7bhqzz7vojq3emrkejmqrr7m overview.URLs[1].u='blahblah'
$ op edit item kd7bhqzz7vojq3emrkejmqrr7m overview.URLs[2]='{"l": website 3", "u": "blahblah"}'
$ op edit item kd7bhqzz7vojq3emrkejmqrr7m overview.URLs.2='{"l": website 3", "u": "blahblah"}'

but they always just give [ERROR] ... The item doesn't have a "URLs.1.u" field. (or similar).
I don't see any documentation of assignment statement syntax that would accomplish this. Am I missing something, or is this not supported (yet)?


1Password Version: 1.8.0
Extension Version: Not Provided
OS Version: Not Provided
Sync Type: Not Provided
Referrer: forum-search:op edit item

Comments

  • ag_yaron
    ag_yaron
    1Password Alumni

    Hey @P1h3r1e3d13 ,

    Looks like what you are trying to do is not supported yet. The only thing that is possible is editing the first URL of an item using op edit item [UUID] url=www.website.com

    Editing existing items is a bit limited at the moment and we hope to improve and enhance it in the future :)

  • P1h3r1e3d13
    P1h3r1e3d13
    Community Member

    Thanks for confirming, @ag_yaron, and I'll look forward to the enhancements.
    Is there (or could there please be) documentation of which fields are supported? It's really unclear here and in the --help output.

  • ag_yaron
    ag_yaron
    1Password Alumni

    The reference guide you linked to is the best source of information on the CLI at the moment.

    I'll forward your request for better documentation. Thank you for bringing that up! :+1:

This discussion has been closed.