cue icon indicating copy to clipboard operation
cue copied to clipboard

cmd/cue: select best quoting mechanism when importing

Open cueckoo opened this issue 4 years ago • 1 comments

Originally opened by @mvdan in https://github.com/cuelang/cue/issues/124

Imagine the yaml below:

cmds:
  - printf "%!s(MISSING)" $FOO

This will end up something like "printf \"%!s(MISSING)\" $FOO". It would be nicer if it instead avoided the backslashes, like #"printf "%!s(MISSING)" $FOO"#.

Perhaps it could do the same for multi-line strings and other common scenarios. This isn't about saving bytes, but about readability.

/cc @rogpeppe

cueckoo avatar Jul 03 '21 10:07 cueckoo

Original reply by @mpvl in https://github.com/cuelang/cue/issues/124#issuecomment-535448216

A general "pretty quoter" is somewhat non-trivial, which is why I haven't done it yet.

But I agree this would be better.

cueckoo avatar Jul 03 '21 10:07 cueckoo