Keats / kickstart

A scaffolding tool to get new projects up and running quickly
MIT License
354 stars 24 forks source link

Support input file #50

Open chevdor opened 3 years ago

chevdor commented 3 years ago

The ability to pass the variables using an input file would be great.

That means a user could run (for instance):

kickstart \
   https://github.com/some/template \
   --data https://gist.github.com/chevdor/050df6...c6e4207

or

curl https://gist.github.com/chevdor/050df6...c6e4207 | \
   kickstart \
      https://github.com/some/template

where in this example https://gist.github.com/chevdor/050df6...c6e4207 points to a file containing all the fields. This could be a local file or a url.

Since the template is defined in toml, a first implementation could use toml as well. json can be helpful thanks to the pre/re-processing that can be done using jq.

That allows for instance, storing several sets of values in a single json map for instance:

curl https://gist.github.com/chevdor/050df6...c6e4207 | jq .scenario_1 \
   kickstart \
      https://github.com/some/template

where the json file could be something like:

{
   "scenario_1": {
      "greeting_recipient": "Alice"   
   },
  "scenario_2": {
      "greeting_recipient": "Bob"   
   },
}

That allows one-liners to bootstrap projects without any user input and with more flexibility than just using the default values from the template.

Keats commented 3 years ago

Do you have an example on where you would use that? I don't see where you would use kickstart in that way

chevdor commented 3 years ago

Testing or scaffolding your template with different inputs (not only the defaults) in CI for instance.

hmuendel commented 1 year ago

I also find this useful for populating values that are bound to me personally. For example when using your CLI template I could use a file that holds my name and email and then provide it for every templating run to create a new project so I only would need to provide the changing params.