Forum Discussion

Anonymous's avatar
Anonymous
4 years ago

CLI V2 returns `-- fields` surrounded in double quotes, V1 didn’t

There is a pretty big breaking change in the CLI V2.
It now returns fields wrapped in double quotes.
Is this intended behavior? Any simple suggestion for getting it back to returning without those quotes?

Here’s a pretty minimally reproducible example:
echo '{ "title": ".env.local2", "category": "SECURE_NOTE", "fields": [ { "id": "notesPlain", "type": "STRING", "purpose": "NOTES", "label": "notesPlain", "value": "NEXT_PUBLIC_ENV=\"DEV\"" } ] }' > template.json

op item create --template template.json
ID: nfuwzcobqgc4gq764nqefk6g2q
Title: .env.local2
Created: now
Updated: now
Favorite: false
Version: 0
Category: SECURE_NOTE
Fields:
notesPlain: NEXT_PUBLIC_ENV="DEV"

op item get .env.local2 --fields notesPlain
"NEXT_PUBLIC_ENV=""DEV"""
op1 get item .env.local2 --fields notesPlain
NEXT_PUBLIC_ENV="DEV"


1Password Version: 2.0.0
Extension Version: Not Provided
OS Version: macOS 12.3

11 Replies

  • Anonymous's avatar
    Anonymous

    I found a temporary fix op item get .env.local2 --fields notesPlain | xargs echo

    Edit:
    When you have something in the note like:
    NEXT_PUBLIC_ENV="DEV"
    NEXT_PUBLIC_API_HOST="http://localhost:8000"

    Then the xargs trick doesn't work.

    However this does work:
    op item get .env.local --fields notesPlain --format json | jq '.value' -r