Git Product home page Git Product logo

scaffold-rs's Introduction

scaffold-rs

GitHub language count GitHub Build Status

Create files and directories recursively

Usage

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

Templates

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

Path syntax

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

Build

On linux :

  make release

On windows :

  cargo build --release

Install

On linux :

  make release
  sudo make install

Uninstall

On linux :

  sudo make uninstall

Test

On linux :

  make test

On windows :

  cargo test

Handle errors

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.

scaffold-rs's People

Contributors

eonm avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.