bindl-dev / bindl

Project-defined static binary manager.
https://bindl.dev
Apache License 2.0
7 stars 0 forks source link

`bindl add` for quick add #68

Open wilsonehusin opened 2 years ago

wilsonehusin commented 2 years ago

I'm starting to find myself getting tired of writing duplicates for bindl.yaml in different repositories. I think it might be time to add a convenience method of bindl add to add commonly used programs.

For example, I use ko a lot and I would like to run something like the following to append the program to bindl.yaml.

bindl add github:google/ko

There is a problem with automatic adding / modifying bindl.yaml directly though: it removes any comments, which is an undesirable outcome.

One way we can do this is to use something like bindl.d/ko.yaml and have bindl sync read all of bindl.d.

chrisyxlee commented 2 years ago

There is a problem with automatic adding / modifying bindl.yaml directly though: it removes any comments, which is an undesirable outcome.

Why would this happen? Can't the parsing just append after the last entry (and before any comments that are right before the next section)? Or is this something to do with YAML parser?

wilsonehusin commented 2 years ago

Can't the parsing just append after the last entry (and before any comments that are right before the next section)

That is assuming all bindl.yaml starts with platforms and ends with programs — if the order were flipped, it would still be a valid bindl.yaml and in that scenario, appending the last entry would go to platforms block instead of programs.

chrisyxlee commented 2 years ago

Understandable -- turns out YAML was not designed for programmatic editing, and I was naive to think that it's as simple as just finding programs and adding an entry before the next top-level section. Turns out you can have variations on spacing (2 or 4 spaces) as well.

https://stackoverflow.com/questions/60891174/i-want-to-load-a-yaml-file-possibly-edit-the-data-and-then-dump-it-again-how

wilsonehusin commented 2 years ago

turns out YAML

Welcome to YAML engineering!