askit
askit is a simple and semantic Rust library to handle interactive CLI prompts, inspired by Python's input.
It provides an ergonomic and type-safe way to ask users for values, validate them, and display custom messages.
Features
input!macro: Ask the user for input with minimal boilerplate.- Typed input: Directly parse inputs into Rust types like
i32,f64,bool,String, and more. - Validation: Attach custom validation logic.
- Messages: Attach messages or hints to guide the user.
- Defaults: Provide default values if the user presses Enter.
Installation
Add the following to your Cargo.toml:
[]
= "0.1.0"
Quickstart
use input;
Usage Examples
1. Basic input! macro
use input;
2. With default values
use Input;
3. With validation
use Input;
Running Examples
Run the examples included in the repository:
Testing
Run the test suite:
Development Guide
Branching Strategy
main: Always production-ready.develop: Integration branch for new features.feature/*: Each feature should have its own branch.hotfix/*: For urgent fixes to production.
Commit Convention
Follow the Conventional Commits standard:
feat:– New feature.fix:– Bug fix.docs:– Documentation changes.style:– Code style changes (formatting, etc).refactor:– Code refactoring.test:– Adding or fixing tests.chore:– Other changes (build tools, CI, etc).
Example:
feat(input): add default typed values
fix(validate): correct error message display
License
MIT License.