Issues migrating to verion 2

BradTH
BradTH
Community Member

Hey guys I had been 1password CLI to grab a bunch of secure notes as part of an Automation script to set up a bunch of development projects faster. (Downloading secure notes containing environment settings, auth keys and configs etc).

I recently got an M1 MacBook (coming from Linux on Windows) and the usual v1 CLI no longer runs. So I installed version 2 via brew which seems to be the only way forward atm and 💥

Version 2 broke everything due to the confusing design choice of no longer getting a JSON response that is easily parsable in most programming languages.🤨 (also the reordering of command arguments broke but that's a minor fix)

So before it was one line of code to parse the response into an object with easily accessible keys to grab anything I want from eh response and now the response is in a plain text format with a bunch of added white space to indent the note.

This is crazy IMO as this means I now have to go write a bunch of code to manually parse the output and extract the secure note out of the response without all the whitespace added into it. 😡
I then see you have a --fields option so I breathe a sigh of relief and add --fields notesPlain to the command, only to find out that this adds a bunch of extra double quotes and forces me to manually parse and strip out all the extra double quotes from my secure notes! 🤯🔫

So after wasting a whole day on this when everything else "lets do some minor adjustment run my scripts on M1" to "why the 🤬 is 1password making life so difficult with CLI v2!" and going back to my windows PC until I have time to deal with this problem.

I understand the changing of the command arguments for version 2 but to ditch the universal JSON format? and then start mangling the data if accessed directly?

At the very least provide an option to return the data in the same format as v1. Or ideally, fix version 1 so it can run on M1 Macs even if its via rosetta.

Please tell me if there's a way to avoid wasting my time building an output parser for 1Password CLIv2. 😭


1Password Version: opCLI v2.4.0
Extension Version: Not Provided
OS Version: macos12.4 (on m1 pro)

Comments

  • BradTH
    BradTH
    Community Member

    OMG there is a --format json so my rant was not even necessary. I didn't see it because I was only reading the help for the get/item command.

  • simon_1P
    edited June 2022

    Hi @BradTH, I'm sorry to hear about your initial experiences with v2! Happy to hear you've found the --format json option now. How do you like v2 now that you've found this?

    If you'd like to always return JSON, setting the OP_FORMAT environment variable to json might be useful for you, so you don't have to pass the flag to each and every command that you run.

    Have you already found the upgrade guide for CLI v2? I'll file an internal ticket for us to document --format and $OP_FORMAT there.

  • BradTH
    BradTH
    Community Member

    It works. I don't use it much only to grab notes. Once I updated my automation scripts I never touched it again lol.

  • Glad to see you got it working, BradTH! Let us know if any other issues arise.

    Thanks,
    Horia

This discussion has been closed.