diff options
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..e1adde7 --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,29 @@ +use clap::Parser; + +#[derive(Parser, Debug)] +#[command(author, version, about, long_about = None)] +pub struct Cli { + /// List all roles + #[clap(short = 'L', long)] + pub list_roles: bool, + /// Specify the role that the AI will play + #[clap(short, long)] + pub role: Option<String>, + /// Input text, if no input text, enter interactive mode + text: Vec<String>, +} + +impl Cli { + pub fn text(&self) -> Option<String> { + let text = self + .text + .iter() + .map(|x| x.trim().to_string()) + .collect::<Vec<String>>() + .join(" "); + if text.is_empty() { + return None; + } + Some(text) + } +} |
