feat: add --info (#79)

This commit is contained in:
sigoden 2023-03-20 16:51:06 +08:00 committed by GitHub
parent acddece520
commit 28f019b72c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -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>,
}

View File

@ -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) {