ffizer 2.6.1

ffizer is a files and folders initializer / generator. It creates or updates any kind (or part) of project from template(s)
Documentation

ffizer

crates license crate version

Project Status: Active – The project has reached a stable, usable state and is being actively developed. Actions Status test coverage

crates download GitHub All Releases

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

keywords: file generator, project template, project scaffolding, quick start, project bootstrap, project skeleton

asciicast: ffizer demo

Features

  • Create or update files and folder from one (or several) template(s).
  • A native executable (cli)
    • Install via download a standalone single file on system (no requirements like python, ruby, nodejs, java, ...).
    • Run as fast enough project generator.
    • Run with dry mode (useful to test).
    • Support self-upgrade.
  • A rust library
    • Can be included into other tool
  • Templates Authoring
    • Can be used for any file & folder generation (no specialization to one ecosystem).
    • Can start as simple as a folder to copy "as is".
    • Can use the Handlebars template syntax for file content, extended with functions:
      • To transform strings (toUpperCase, toLowerCase, Capitalize,...)
      • To retrieve content via http get (like .gitignore from gitignore.io, license from spdx)
      • ...
    • Can replace variables part in file and folder's name
    • Can be composed of other templates (applied as layer)
    • Can ignore file / folder under conditions
    • Can store the content at the root of the folder or under the sub-folder template
  • Templates Hosting
    • On a local folder
    • On a hosted git repository (public / private, github / bitbucket/ gitlab / ...)
      • At the root of the repository
      • In a sub-folder of the repository
      • In any revision (branch, tag, commit)

Suggestions are welcomes ;-)

A list of alternatives is available on the wiki, feel free to complete / correct.

Usages

Install

curl https://raw.githubusercontent.com/ffizer/ffizer/master/scripts/getLatest.sh | bash

Or download the binary for your platform from github releases, then un-archive it and place it your PATH.

via homebrew (MacOs & Linux)

brew install ffizer/ffizer/ffizer-bin
ffizer upgrade

via cargo

cargo install ffizer --force --features cli

Run

❯ ffizer --help
ffizer 2.5.0
https://ffizer.github.io/ffizer/book/
ffizer is a files and folders initializer / generator.
It creates or updates any kind (or part) of project from template(s)

USAGE:
    ffizer [OPTIONS] <SUBCOMMAND>

OPTIONS:
    -h, --help       Print help information
    -v, --verbose    Verbose mode (-v, -vv (very verbose / level debug), -vvv) print on stderr
    -V, --version    Print version information

SUBCOMMANDS:
    apply               Apply a template into a target directory
    help                Print this message or the help of the given subcommand(s)
    inspect             Inspect configuration, caches,... (wip)
    show-json-schema    Show the json schema of the .ffizer.yaml files
    test-samples        test a template against its samples
    upgrade             Self upgrade ffizer executable

Self upgrade the executable

  ffizer upgrade

Apply a template (to create or update)

 ffizer apply --help
ffizer-apply 2.5.0
https://ffizer.github.io/ffizer/book/
Apply a template into a target directory

USAGE:
    ffizer apply [OPTIONS] --source <URI> --destination <DST_FOLDER>

OPTIONS:
        --confirm <CONFIRM>
            ask for plan confirmation [default: Never] [possible values: auto, always, never]

    -d, --destination <DST_FOLDER>
            destination folder (created if doesn't exist)

    -h, --help
            Print help information

        --offline
            in offline, only local templates or cached templates are used

        --rev <REV>
            git revision of the template [default: master]

    -s, --source <URI>
            uri / path of the template

        --source-subfolder <SUBFOLDER>
            path of the folder under the source uri to use for template

        --update-mode <UPDATE_MODE>
            mode to update existing file [default: Ask] [possible values: ask, keep, override,
            update-as-remote, current-as-local, show-diff, merge]

    -v, --variables <KEY_VALUE>
            set variable's value from cli ("key=value")

    -V, --version
            Print version information

    -y, --no-interaction
            should not ask for confirmation (to use default value, to apply plan, to override, to
            run script,...)
  • use a local folder as template

    ffizer apply --source $HOME/my_templates/tmpl0 --destination my_project
    
  • use a remote git repository as template

    ffizer apply --source https://github.com/ffizer/template_sample.git --destination my_project
    

    output

      Configure variables
    
       project_name · my-project
       package_name · my_project
    
    
      Plan to execute
    
        - make dir        my_project
        - make dir         ├─dir_1
        - add file         │  └─file_1_1.txt
        - make dir         ├─dir_2_my-project
        - add file         │  └─file_1_2.txt
        - add file         ├─file_1.txt
        - add file         ├─file_2.txt
        - add file         ├─file_3.txt
        - add file         ├─file_4_my_project.txt
        - add file         ├─file_5_my-project.txt
        - add file         └─file_6.hbs
    

Authoring a template

Start with Template Authoring Tutorial

Few templates

Build

cargo install cargo-make --force
cargo make ci-flow

Update CHANGELOG.md

cargo make update-changelog
git add CHANGELOG.md
git commit -m ':memo: (CHANGELOG) update'

Release a new version by bump patch (or minoror major)

cargo make publish --execute patch --dry-run
cargo make publish --execute patch