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

The write command doesn't support anchor and alias #377

Closed
gadisn opened this issue Feb 27, 2020 · 2 comments
Closed

The write command doesn't support anchor and alias #377

gadisn opened this issue Feb 27, 2020 · 2 comments
Milestone

Comments

@gadisn
Copy link

gadisn commented Feb 27, 2020

Describe the bug
Trying to write an anchor or an alias creates a value wrapped with single quotes, which then cannot be used as anchor or alias.

Command
Example1 – writing anchor (&)

yq write -i file.yaml key1 "&myAnchor myValue"

Actual behavior

key1: '&myAnchor myValue'

Expected behavior

key1: &myAnchor myValue

Example2 – writing alias (*)

yq write -i file.yaml key2 *myAlias

Actual behavior

key2: '*myAlias'

Expected behavior

key2: *myAlias

Example3 – writing a value with spaces – works fine, without wrapping with single quotes

yq write -i file.yaml key3 "multi word value"

Actual behavior

key3: multi word value

Expected behavior

key3: multi word value
@gadisn gadisn added the bug label Feb 27, 2020
@mikefarah mikefarah added enhancement and removed bug labels Apr 29, 2020
@mikefarah
Copy link
Owner

I think this would need a separate anchorName flag, setting that would set the anchorName...

yq write -i file.yaml key1 --anchorName="myAnchor" "myValue"

@mikefarah
Copy link
Owner

I'll aim to get something in the next release - sorry for the long time to response!

@mikefarah mikefarah added this to the 3.3.1 milestone Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants