carvel-dev / carvel-dev/ytt

[lang] support emitting comments in resulting YAML

Open
#63 39 comments 26 reactions 0 assignees View on GitHub
discussion enhancement lang support
Dominant language
Go
Stars
1.9k
Forks
167
PR merge metrics
No merged PRs in 30d

Description

originally @patricknelson added as a comment to related issue: https://github.com/k14s/ytt/issues/14#issuecomment-542965903:

It's not always essential for the resulting YAML to have comments for me, but it certainly would be very helpful!

What if we were to use a double `#` to work as an escape method when at the beginning of a line, so that the resulting YAML will contain a standard comment? For example, taken from the main demo at https://get-ytt.io:

```yaml
#@ def labels():
#! This is a ytt comment
## This is a yaml comment
app: echo
org: test
#@ end

kind: Pod
apiVersion: v1
metadata:
name: test-comments
labels: #@ labels()
```

With the output resulting in:

```yaml
kind: Pod
apiVersion: v1
metadata:
name: echo-app
labels:
# This is a yaml comment
app: echo
org: test
```

I'm brand new to `ytt` (just doing research right now), so I'm asking just in case this isn't already available with first class syntax support without any special flags.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.