This directory contains example templates that demonstrate the scrap template system.
A minimal C++ application template that generates:
scrap.tomlwith basic application configurationsrc/main.cppwith simple Hello World programtests/main_test.cppwith basic test setup
A minimal C++ library template that generates:
scrap.tomlwith basic library configurationinclude/{{name}}/{{name}}.hwith public APIsrc/{{name}}.cppwith implementationtests/{{name}}_test.cppwith unit testsexamples/usage.cppwith usage example
These examples show the structure that will be used in the official github.com/skipbit/scrap-templates repository.
# Test minimal-app template
scrap new myapp --template=./examples/templates/minimal-app
# Test minimal-lib template
scrap new mylib --type=lib --template=./examples/templates/minimal-lib{{name}}- Project name{{version}}- Project version{{author}}- Author name{{year}}- Current year{{namespace}}- Custom variable with default
{{namespace|snake_case}}- Convert to snake_case- Other transforms:
PascalCase,camelCase,UPPER_CASE,kebab-case
Each template includes a template.toml file with:
- Basic metadata (name, version, description)
- Variable definitions with prompts and defaults
- Requirements and compatibility information
- Default dependencies
Templates can include:
- Files with variable placeholders in names:
{{name}}.cpp - Directory names with placeholders:
include/{{name}}/ - Content with variable substitution
- Conditional sections (future feature)
- Create a directory with your template name
- Add
template.tomlwith metadata - Add template files with placeholders
- Test locally with
--template=/path/to/template
For complete details about the template system, see the documentation in the main scrap repository.