diff options
| author | sigoden <sigoden@gmail.com> | 2023-03-20 16:51:06 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-20 16:51:06 +0800 |
| commit | 28f019b72c1027207ec8dc82844401512712464d (patch) | |
| tree | 2deba80833bf8dfb098e4911ff89d9eabb6c0fd2 /src | |
| parent | acddece5205c34338ad8519ab98f2420a9ddb0dc (diff) | |
| download | aichat-28f019b72c1027207ec8dc82844401512712464d.tar.gz | |
feat: add `--info` (#79)
Diffstat (limited to 'src')
| -rw-r--r-- | src/cli.rs | 3 | ||||
| -rw-r--r-- | src/main.rs | 5 |
2 files changed, 8 insertions, 0 deletions
@@ -24,6 +24,9 @@ pub struct Cli { /// Select a role #[clap(short, long)] pub role: Option<String>, + /// Print information + #[clap(long)] + pub info: bool, /// Input text text: Vec<String>, } diff --git a/src/main.rs b/src/main.rs index 589e865..58fa954 100644 --- a/src/main.rs +++ b/src/main.rs @@ -60,6 +60,11 @@ fn main() -> Result<()> { if let Some(prompt) = &cli.prompt { config.write().add_prompt(prompt)?; } + if cli.info { + let info = config.read().info()?; + println!("{info}"); + exit(0); + } let no_stream = cli.no_stream; let client = ChatGptClient::init(config.clone())?; if atty::isnt(atty::Stream::Stdin) { |
