ffizer 0.3.0

ffizer is a files and folders initializer / generator. Create any kind (or part) of project from template.

ffizer

Crates.io Crates.io

Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. Build Status

Crates.io GitHub All Releases

ffizer is a files and folders initializer / generator. Create any kind (or part) of project from template.

keywords: file generator, project template, project scaffolding, quickstart, project initializer, project skeleton

1. Motivations

1.1. Main features

  • project generator as a standalone executable (no shared/system dependencies (so no python + pip + ...))
  • a simple and generic project template (no specialisation to one ecosystem)
  • template as simple as possible, like a
    • copy or clone with file/folder renames without overwrite
    • few search and replace into file
    • chain commands (eg: 'git init') (like a post-hook)
  • template hosted as a local folder on the file system
  • template hosted as a (top) git repository on any host (not only public github)
  • a fast enough project generator

1.2. Sub features

  • dry mode (usefull to test)
  • chain template generation because fragment of templates can be commons

2. Limitations

Some of the following limitations could change in the future (depends on gain/loss):

  • no conditionnals file or folder creation
  • no update of existing file or folder
  • no specials features
  • no plugin and not extensible (without change the code)
  • handlebars is the only template language supported (support for other is welcome)

3. Usages

3.1. Install

3.1.1. via github releases

Download the binary for your platform from github releases, then unarchive it and place it your PATH.

3.1.2. via cargo

cargo install ffizer

3.2. Run

ffizer 0.3.0
davidB
ffizer is a files and folders initializer / generator. Create any kind (or part) of project from template.

USAGE:
    ffizer [FLAGS] [OPTIONS] --destination <dst_folder> --source <src_uri>

FLAGS:
    -h, --help                      Prints help information
    -V, --version                   Prints version information
    -v, --verbose                   Verbose mode (-v, -vv (very verbose / level debug), -vvv) print on stderr
        --x-always_default_value    should not ask for valiables values, always use defautl value or empty (experimental
                                    - for test only)

OPTIONS:
        --confirm <confirm>           ask confirmation 'never', 'always' or 'auto' (default) [default: auto]
    -d, --destination <dst_folder>    destination folder (created if doesn't exist)
    -s, --source <src_uri>            uri / path of the template

3.3. Create your first template

( from scratch without ffizer ;-) )

# create the folder with the template
mkdir my-template
cd my-template

# add file that will be copied as is
cat > file0.txt <<EOF
I'm file0.
EOF

# add a template file that will be "rendered" by the handlebars engine
# - the file should have the .ffizer.hbs extension,
# - the extension .ffizer.hbs is removed from the generated filename
# - [Handlebars templating language](https://handlebarsjs.com/)
cat > file1.txt.ffizer.hbs <<EOF
I'm file1.txt of {{ project }}.
EOF

# add a file with a name that will be "rendered" by the handlebars engine
# - the file should have {{ variable }},
# - [Handlebars templating language](https://handlebarsjs.com/)
cat > '{{ project }}.txt' <<EOF
I'm a fixed content file with rendered file name.
EOF

The minimal template is an empty dir.

4. Build

5. Alternatives

5.1. Generic

  • Cookiecutter, lot of templates, require python + pip + install dependencies on system (automatic)
  • Cookiecutter — Similar projects
  • sethyuan/fgen: A file generator library to be used to generate project structures, file templates and/or snippets. Templates are based on mustache. require nodejs
  • project_init in rust, use mustache for templating but I have some issues with it (project template creation not obvious, github only, plus few bug) I could contributes but I have incompatible requirements (and would like to create my own since a long time).
  • skeleton, good idea but no template file, more like a script.
  • porteurbars, very similar but I discover it too late.

5.2. Specialized

specilazed to a platform, build tool,...