summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2023-03-20 16:51:06 +0800
committerGitHub <noreply@github.com>2023-03-20 16:51:06 +0800
commit28f019b72c1027207ec8dc82844401512712464d (patch)
tree2deba80833bf8dfb098e4911ff89d9eabb6c0fd2
parentacddece5205c34338ad8519ab98f2420a9ddb0dc (diff)
downloadaichat-28f019b72c1027207ec8dc82844401512712464d.tar.gz
feat: add `--info` (#79)
-rw-r--r--src/cli.rs3
-rw-r--r--src/main.rs5
2 files changed, 8 insertions, 0 deletions
diff --git a/src/cli.rs b/src/cli.rs
index 9211878..fd56e8b 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -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) {