https://github.com/initerworker/inquire_derive
Experimental support for inquire derive
https://github.com/initerworker/inquire_derive
Last synced: about 1 year ago
JSON representation
Experimental support for inquire derive
- Host: GitHub
- URL: https://github.com/initerworker/inquire_derive
- Owner: IniterWorker
- License: mit
- Created: 2022-10-24T02:39:16.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-11-10T18:31:26.000Z (over 3 years ago)
- Last Synced: 2025-03-25T18:12:37.279Z (about 1 year ago)
- Language: Rust
- Size: 66.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Inquire Derive
---
Library to support `inquire_derive` via `proc-macro`.
## Early stage
- Derive support for [inquire](https://github.com/mikaelmello/inquire) see [#supported](#supported-widgets).
- Original feature request [inquire #65](https://github.com/mikaelmello/inquire/issues/65)
## Supported Widgets
* [x] __Text__
* [x] __Select__
* [x] __MultiSelect__
* [x] __CustomType__
* [x] __Editor__
* [x] __Password__
* [x] __Confirm__
* [x] __DateSelect__
* [x] __Nested__
## Inquire Derive in action
Click to show Cargo.toml.
```toml
[dependencies]
# The inquire derive crate
inquire = { version = "0.5.2" }
inquire_derive = { git = "https://github.com/IniterWorker/inquire_derive", branch = "master" }
```
```rust
use inquire_derive::InquireForm;
#[derive(Debug, InquireForm)]
pub struct Demo {
#[inquire(text(
prompt_message = "\"What's your path?\"",
initial_value = "\"/my/initial/path\"",
placeholder_value = "\"/my/placeholder/path\"",
))]
pub path: String,
}
impl Default for Demo {
fn default() -> Self {
Self {
path: "/my/default/path".to_string(),
}
}
}
fn main() {
let mut ex = Demo::default();
println!("{:?}", ex.inquire_mut().unwrap());
}
```
## Examples
* __Text__: `cargo run --example text`
* __Select__: `cargo run --example select`
* __MultiSelect__: `cargo run --example multi_select`
* __CustomType__: `cargo run --example custom_type`
* __Editor__: `cargo run --example editor`
* __Password__: `cargo run --example password`
* __Confirm__: `cargo run --example confirm`
* __DateSelect__: `cargo run --example date_select`
* __Form(Nested)__: `cargo run --example form`
## License
See LICENSE for details.