carvel-dev / carvel-dev/ytt

RFE: Adding array items with from the command line

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

Description

I have a file `values.yml` that looks like this:

```
#@data/values
---
namespace: default
flavor: medium
disk: 10Gi
ssh_keys: []
```

I would like someone running `ytt` to be able to easily append values to the `ssh_keys` array from the command line (without having to write a YAML list inline). I was envisioning something like this:

```
ytt -f template.yml \
--data-value-file ssh_keys+=$HOME/.ssh/id_rsa_foo.pub \
--data-value-file ssh_keys+=$HOME/.ssh/id_rsa_bar.pub
```

That is, use `+=` to indicate "append to list", rather than trying to set a key on a mapping. Does that seem reasonable?

Contributor guide

Open the contributing guide

Research direction

Start at the ytt command-line handling for --data-value-file, using the values.yml example and template.yml invocation as the behavioral reference. Check how repeated options and ssh_keys: [] are currently processed; done means += appends each supplied file's value to ssh_keys without requiring an inline YAML list.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, yaml
Domain
cli
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.