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

After formatting, the character "," (that is, a comma) appears at the very end before "}" #195

Open
Andy-Solo opened this issue Jul 17, 2024 · 2 comments

Comments

@Andy-Solo
Copy link

After formatting, the character "," (that is, a comma) appears at the very end before "}":

loop:
- {item_name: doc_tools.plugin, item_path: '{3ACCEF78-860F-4D81-89E5-464C907F3628}'}
- {item_name: QRCode.plugin, item_path: '{D20D0768-6968-482B-8CEB-212D801030CF}'}
- {item_name: randomizer.plugin, item_path: '{2E935B75-113D-4613-BEA0-8879A775A42F}',}

or

with_items:
- {path: /root/.bashrc, regex: '[\033[01;32m\]', replace: '[\\033[01;31m\]',}
@braydonk
Copy link
Collaborator

Hi @Andy-Solo thanks for opening a feature request.

I won't have time to work on this in the near future. I'll put an explanation for what I think needs to be done, for either my future self or someone else who might be able to pick it up.

Getting this to work might be non-trivial. I think this is the code that produces the comma for flow mapping nodes: https://github.com/braydonk/yaml/blob/10bcc859418b821726f51e2beb7406449cf0b4a2/emitterc.go#L712-L716

It's hard to tell by reading if that's the spot that matters here, but that's my best guess.

Somehow the parser would need to figure out that the current node is the final flow mapping value, and then optionally emit the comma depending on a yaml_emitter config value. Might be nasty to get working, but perhaps someone other than me will be able to do something easier than what I'm suggesting.

@sdx23
Copy link

sdx23 commented Aug 13, 2024

( duplicate of #110 )

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