Expand description
§wizify
Quick and simple tool to generate a creation wizard based directly off a struct. Uses your field name along with dialoguer to provide basic creation and validation tasks. Currently, this only works with structs, but in the future, I want to add in enums for selection prompts.
⚠️ WARNING ⚠️ This project is under active development. Each release may have breaking changes as I develop the library.
§Usage
In order to generate a creation wizard from a struct, you need to use the Wizard
derive macro. Here’s an example:
#[derive(Wizard, Debug)]
#[wizard(
begin_msg = "✨ Hello, and welcome to the wizify creation wizard 🐧\n\n",
closing_msg = "\nThat was the demonstration of the wizify creation wizard. 🌛",
prefix = " ❓ => "
)]
struct Testing {
#[wizard(prompt = "Enter your name (Optional)")]
name: Option<String>,
#[wizard(prompt = "Enter your favorite color")]
favorite_color: String,
#[wizard(prompt = "Enter your favorite number between 0 and 9", validation = input < 10)]
favorite_number: i32,
}
As of right now, this only supports basic primitives, but in the future I would like to support custom struct fields as well.
§For information on the specifics of the derive options, see the derive macro documentation below.
Traits§
- Wizard
- Trait is populated using the Wizard derive annotation
Derive Macros§
- Wizard
- Struct macro for creating wizard