bootstrap/README.md

99 lines
1.8 KiB
Markdown
Raw Normal View History

2023-11-23 18:02:40 +00:00
# bootstrap
2023-11-25 19:43:41 +00:00
CLI utility for defining custom project initialization scripts.
TODO:
- [ ] Add evaluator tests.
- [ ] Color output to console.
## Overview
2023-11-25 19:43:41 +00:00
`bootstrap` is a tool for quickly defining your own init-like scripts. If you
are familiar with tools like
* `npm init`
* `nix flake init`
* `django-admin startproject`
* `mix phx.new`
* etc.
2023-11-25 19:43:41 +00:00
this project will feel at home. Ultimately the goal is to create (optionally)
interactive scripts like those mentioned in the above list to quickly scaffold
your new projects in a consistent way.
We start with an example. Consider the following *spec*, which we'll name
`example`:
```json
{
2023-11-25 19:43:41 +00:00
"filename": {
"type": "STRING",
2023-11-25 19:48:21 +00:00
"prompt": "What file should I create for you? "
2023-11-25 19:43:41 +00:00
}
}
```
2023-11-25 19:43:41 +00:00
and its associated *builder*:
```bash
#!/usr/bin/env bash
echo "Creating $FILENAME"
touch "$OUT/$FILENAME"
```
Running `bootstrap` with these two files configured will invoke the following
interactive script:
```bash
> bootstrap example
2023-11-25 19:48:21 +00:00
I: What file should I create for you? hello-world.txt
O: Creating hello-world.txt
2023-11-25 19:43:41 +00:00
>
```
2023-11-25 19:48:21 +00:00
Here the line prefixed with `I:` indicates a prompt that must be answered by
the user. The line prefixed with `O:` indicates the output of the builder
script. You should now see a new `hello-world.txt` file in your current working
directory.
2023-11-25 19:43:41 +00:00
## Usage
2023-11-25 19:43:41 +00:00
TODO
2023-11-25 19:43:41 +00:00
### Installation
TODO
### Specs and Builders
TODO
### Other Environment Variables
TODO
### Supplied Specs
TODO
### Using With Nix
TODO
2023-11-23 15:21:50 +00:00
## Development
2023-11-25 19:43:41 +00:00
TODO
### Documentation
TODO
2023-11-23 15:21:50 +00:00
### Formatting
A `pre-commit` file is included in `.githooks` to ensure consistent formatting.
Run the following to configure `git` to use it:
```bash
git config --local core.hooksPath .githooks/
```
2023-11-25 19:43:41 +00:00
If running [direnv](https://direnv.net/), this is done automatically if `git` is
installed.