Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Generating Config Files

You can use the sketch new command to generate a new configuration file in the desired output file and format. The default is sketch.yaml, but any name is supported as long as the format is either json, toml or yaml, and the configuration file is specified with the -c or --config flag.

If extra arguments are provided, the generated config will populated with the values of these arguments. So if we run sketch --templates-dir "/path/to/templates", templates_dir will be set to that path in the generated config.

⚠️ Since the default sketch.yaml file is always automatically detected, if there is such a file in the cwd and you want to create a new config with certain values, you need to use --ignore-config-file to ignore the config file's values.

Command:

sketch --templates-dir tests/templates --shell zsh --set hello="there" --set general="kenobi" new tests/output/generated_configs/with_extras.yaml

Output:

shell: zsh
root_dir: tests/output
templates_dir: tests/templates
no_overwrite: false
pre_commit: true
templates: {}
templating_presets: {}
vars:
  hello: there
  general: kenobi

Repo Setup

You can also use the init command to create a new git repo. This command will:

  1. Create a new git repo in the specified root_dir.
  2. If a --remote is provided, it will also add that remote as the origin/main for the repo.
  3. Unless pre-commit is disabled, it will generate a new .pre-commit-config.yaml file in the root, with the repos specified in the config file (if there are any, otherwise it will just add the gitleaks repo). It will then run pre-commit install to install the given hooks.