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

Thoughts on folded text block? #538

Closed
drewgingerich opened this issue Jun 1, 2021 · 1 comment
Closed

Thoughts on folded text block? #538

drewgingerich opened this issue Jun 1, 2021 · 1 comment

Comments

@drewgingerich
Copy link

drewgingerich commented Jun 1, 2021

This is cross-posted at google/jsonnet.

YAML has folded-style multi-line strings, which means that new-lines are replaced with spaces to end up with a single-line string. I find this convenient for splitting long shell commands over multiple lines for readability. Does this seem like something potentially good to implement?

For example and context, I'm looking at using jsonnet to produce YAML Gitlab CI config files. By hand a simplified version looks like this:

build:
  stage: build
  only:
    - main
  image: my.kaniko.image
  script:
    - init-kaniko
    - >-
      /kaniko/executor
      --context .
      --dockerfile Dockerfile
      --destination $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
      --destination $CI_REGISTRY_IMAGE:latest

I really like how I can format the second command in the script block. I think it is very readable and I don't have to fiddle around with escaping new-lines with a \ like I would in a shell script. I would love to be able to do something similar in jsonnet.

@sbarzowski
Copy link
Collaborator

General language issues live by default only in google/jsonnet. Closing here.

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

2 participants