Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: Do not split quoted keys with -d #180

Closed
woky opened this issue May 19, 2022 · 2 comments
Closed

RFE: Do not split quoted keys with -d #180

woky opened this issue May 19, 2022 · 2 comments

Comments

@woky
Copy link

woky commented May 19, 2022

I wanted to compose Docker config file with authentication string for repository foo.azurecr.io/bar with the following jo command:

echo REDACTED | jo -d. auths.'"foo.azurecr.io/bar"'.auth=@-

expecting it to produce:

{
  "auths": {
    "foo.azurecr.io/bar": {
      "auth": "REDACTED"
    }
  }
}

But instead it produced:

{
  "auths": {
    "\"foo": {
      "azurecr": {
        "io/bar\"": {
          "auth": "REDACTED"
        }
      }
    }
  }
}

(Doubly) Quoted strings are supported in jq:

$ jq -r .auths.'"foo.azurecr.io/bar"'.auth <auth.json
REDACTED

It'd be useful if jo didn't split quoted strings when -d option is in effect. I see no use case for current behavior so I presume this won't break anyone's workflow.

@gromgit
Copy link
Collaborator

gromgit commented May 20, 2022

That's unlikely to happen, given that there's already a simple solution available: Use a different delimiter.

$ echo REDACTED | jo -p -d@ auths@foo.azurecr.io/bar@auth=@-
{
   "auths": {
      "foo.azurecr.io/bar": {
         "auth": "REDACTED"
      }
   }
}

@jpmens
Copy link
Owner

jpmens commented May 20, 2022

Closing as solution was offered

@jpmens jpmens closed this as completed May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants