Create files and directories recursively
Display help:
scaffold-rs -h
Basic usage :
scaffold-rs scaffold -t template_file.json
scaffold-rs scaffold -i "input_string"
Dry run :
Only display paths. Generated files and directories won't be created.
scaffold-rs scaffold -t template_file.json --dry-run
Add more verbosity :
scaffold-rs scaffold -t template_file.json -v
Saffold-rs uses json templates to create files and directories.
{
"name": "fake model",
"paths": [
"./path_[1-20]/file_[2-10].txt",
"file_[2-10].txt"
],
"licence": "MIT",
"author": "eonm",
"email": "",
"notes": ""
}
A typical template contains the following elements:
- a name
- a list of paths
- a licence
- an author
- an email
- some notes
Name and paths fields are mendatory
Directories :
Unlike files, directories paths always end with "/".
Range :
Ranges are written as follow : [startingNumber-endingNumber]
./dir/files_[1-6].txt
# will produce :
## dir are created first
# ./dir/
## files are created next
# ./dir/files_1.txt
# ./dir/files_2.txt
# ./dir/files_3.txt
# ./dir/files_4.txt
# ./dir/files_5.txt
# ./dir/files_6.txt
Multiple ranges can be defined for one path
./dir_[1-2]/files_[1-3].txt
# will produce :
## dir are created first
# ./dir_1
# ./dir_2
## files are created next
# ./dir_1/files_1.txt
# ./dir_1/files_2.txt
# ./dir_1/files_3.txt
# ./dir_2/files_1.txt
# ./dir_2/files_2.txt
# ./dir_2/files_3.txt
Parent Directory :
References to a parent directory are written as follow : [*]
./chapter_1/[*]_section_[1-6].txt
# will produce :
## dir are created first
# ./chapter_1
## files are created next
# ./chapter_1/chapter_1_section_1.txt
# ./chapter_1/chapter_1_section_2.txt
# ./chapter_1/chapter_1_section_3.txt
# ./chapter_1/chapter_1_section_4.txt
# ./chapter_1/chapter_1_section_5.txt
# ./chapter_1/chapter_1_section_6.txt
Multiple references to a parent directory can be defined
./chapter_[1-2]/[*]_sections/[*]_[1-3].txt
# will produce :
## dir are created first
# ./chapter_1/chapter_1_sections/
# ./chapter_2/chapter_2_sections/
## files are created next
# ./chapter_1/chapter_1_sections/chapter_1_sections_1.txt
# ./chapter_1/chapter_1_sections/chapter_1_sections_2.txt
# ./chapter_1/chapter_1_sections/chapter_1_sections_3.txt
# ./chapter_2/chapter_2_sections/chapter_2_sections_1.txt
# ./chapter_2/chapter_2_sections/chapter_2_sections_2.txt
# ./chapter_2/chapter_2_sections/chapter_2_sections_3.txt
On linux :
make release
On windows :
cargo build --release
On linux :
make release
sudo make install
On linux :
sudo make uninstall
On linux :
make test
On windows :
cargo test
By default all errors and info are logged in a file called scaffold_log.txt
Most of the time, errors are due to invalid permissions.