A command-line utility that creates project structure.

Overview

petridish

CI Version info GitHub
A command-line utility that creates project structure.

If you have heard of the cookiecutter project, petridish is a rust implementation of it.

Features

Feature Description
Cross platform Windows, Linux, MacOS
More flexible configuration petridish use yaml file to define the template variables
More humanized prompt support different kinds of prompt (input, choice, multi choices, confirm)
Powerful template engine we use tera as our template engine, which is based on Jinja2/Django
One binary one binary run everywhere

Usage

Like cookiecutter, you should provide directory structure like this:

Let's have a look at the petridish.yaml file:

prompts:
  - name: name                   # normal input prompt
    message: what's your name

  - name: age                    # single choice prompt
    choices: [10, 20, 30]
    default: 20

  - name: hobby                  # multi choices prompt
    choices: [running, swimming]
    multi: true

  - name: is_geek                # confirm prompt
    confirm: true

entry_dir: "{{ repo_name }}"     # default is {{ repo_name }}
entry_dir_prompt_message: repo dir name?
Prompt kind Field Description optional
normal input name template_var_name
message prompt message
default default value
single choice name template_var_name
message prompt message
choices choice items
default default value
multi choice name template_var_name
message prompt message
choices choice items
default default values
multi must be true or default is provided
confirm name template_var_name
message prompt message
default default value (default false)

Demo

Template

A Tera template is just a text file where variables and expressions get replaced with values when it is rendered. The syntax is based on Jinja2 and Django templates.

There are 3 kinds of delimiters and those cannot be changed:

  • {{ and }} for expressions
  • {% and %} for statements
  • {# and #} for comments

More syntax details can be found in tera.

You might also like...
A simplified recreation of the command-line utility grep written in Rust.

smolgrep A simplified recreation of the command-line utility grep written in Rust. Download and run Download Rust On Mac/Linux Open a terminal and ent

A utility for managing cargo dependencies from the command line.

cargo edit This tool extends Cargo to allow you to add, remove, and upgrade dependencies by modifying your Cargo.toml file from the command line. Curr

A command line utility to easily make dank memes
A command line utility to easily make dank memes

meme-cli A command line utility to easily make dank memes. Yes, really. Installation cargo install meme-cli Alternatively, install from source using g

🧠 A command-line utility for switching git branches more easily. Switch branches interactively or use a fuzzy search to find that long-forgotten branch name.
🧠 A command-line utility for switching git branches more easily. Switch branches interactively or use a fuzzy search to find that long-forgotten branch name.

git-smart-checkout A git command extension for switching git branches more efficiently. About Interactively switch branches or fuzzy search for that f

Command line utility to remove duplicates from the given input.

Command line utility to remove duplicates from the given input. Note that huniq does not sort the input, it just removes duplicates.

A small command-line utility for encoding and decoding bech32 strings

A small command-line utility for encoding and decoding bech32 strings.

A lightweight command line utility with some small functions for CTFs.

Ice Ice is a lightweight command line utility to help with simple problems encountered while playing CTFs. Extracted from graveyard NOTE: Most of the

A command-line utility which aligns a block of text within the terminal (or a specified number of columns), written in Rust.
A command-line utility which aligns a block of text within the terminal (or a specified number of columns), written in Rust.

align: a command line utility for aligning text. ⭐ Overview Aligns text within the terminal (or a specified number of columns). The text is treated as

This is a command line utility written in Rust that helps you plan factories in Satisfactory.

Satisfactory Factory Planning Utility This is a command line utility written in Rust that helps you plan factories in Satisfactory. Tell it what you w

Comments
  • petridish.yaml files with no prompt section are invalid

    petridish.yaml files with no prompt section are invalid

    I have a project where the general functionality of petridish is useful but dont need it to get any more information from the user than the base project name. As such the prompts setction is unnessecary for my use case. But if I dont include a prompts section and values in that section; petridish considers the file invalid.

    opened by CameronBarnes 0
Releases(0.6.1)
Owner
null
Small command-line tool to switch monitor inputs from command line

swmon Small command-line tool to switch monitor inputs from command line Installation git clone https://github.com/cr1901/swmon cargo install --path .

William D. Jones 5 Aug 20, 2022
A library that creates a terminal-like window with feature-packed drawing of text and easy input handling. MIRROR.

BearLibTerminal provides a pseudoterminal window with a grid of character cells and a simple yet powerful API for flexible textual output and uncompli

Tommy Ettinger 43 Oct 31, 2022
A simple lexer which creates over 75 various tokens based on the rust programming language.

Documentation. This complete Lexer/Lexical Scanner produces tokens for a string or a file path entry. The output is a Vector for the user to handle ac

null 1 Nov 27, 2022
Tracing layer that automatically creates and manages progress bars for active spans.

tracing-indicatif A tracing layer that automatically creates and manages indicatif progress bars for active spans. Progress bars are a great way to ma

Emerson Ford 95 Feb 22, 2023
A simple CLI tool to create python project file structure, written in Rust

Ezpie Create python projects blazingly fast What Ezpie can do? It can create a python project directory What kind of directory can Ezpie create? For c

Faseeh 3 Sep 29, 2023
fixred is a command line utility to fix outdated links in files with redirect URLs.

fixred fixred is a command line utility to fix outdated links in files with redirect URLs. Installation fixred is installed via cargo package manager.

Linda_pp 35 Aug 6, 2022
Rust command line utility to quickly display useful secrets in a Kubernetes namespace

kube-secrets This is a command line utility for quickly looking at secrets in a Kubernetes namespace that are typically looked at by humans. It specif

Frank Wiles 8 Feb 10, 2022
Command line utility for controlling LIFX smart lights

lifxc is a command line utility for controlling LIFX smart lights. Currently, communication over the LIFX LAN protocol is supported.

Harrison Rigg 1 Nov 17, 2021
Gecko's trusty package manager and command-line utility.

Geckos have super-powers, ya'know? Grip is Gecko's trusty package manager and command-line utility. USAGE: grip [FLAGS] [file] [SUBCOMMAND] FLAGS

Gecko 2 Jan 3, 2022