Skip to content

Commit 0be36e4

Browse files
committed
fix(args): report the real binary name, version, and provider list
1 parent 5040a1a commit 0be36e4

2 files changed

Lines changed: 29 additions & 4 deletions

File tree

crates/llm_stream/src/args.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,18 @@ impl FromStr for Api {
9191
}
9292

9393
#[derive(Default, Clone, Debug, Parser, PartialEq, Serialize, Deserialize)]
94-
#[command(name = "e", version = "0.1.0")]
94+
#[command(name = "llm-stream", version)]
9595
#[command(about = "Interact with LLMs through the terminal")]
9696
#[command(
9797
long_about = "This Rust-based CLI enables users to interact with various Large Language Models
98-
(LLMs) directly from the terminal. Through this tool, you can send prompts to different
99-
APIs, such as OpenAI, Anthropic, Google, Mistral, and Mistral FIM, and receive and handle
100-
responses from these models.
98+
(LLMs) directly from the terminal. Through this tool, you can send prompts to OpenAI,
99+
Anthropic, Google, Mistral, Mistral FIM, Ollama, Groq, DeepSeek, or a ChatGPT subscription
100+
account, and receive and handle responses from these models.
101+
102+
The `chatgpt` provider works differently from the rest: it signs in to a ChatGPT
103+
subscription with `--login` instead of taking an API key, it is steered with
104+
`--reasoning-effort` and `--reasoning-summary` rather than `--temperature` and `--top-p`,
105+
and `--models` reports which models the signed-in account may use.
101106
102107
The tool offers extensive configuration options, allowing you
103108
to specify parameters like model type, maximum and minimum tokens, temperature, top-p

crates/llm_stream/tests/cli.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,23 @@ fn models_without_credentials_names_the_login_command() {
6666
);
6767
assert!(stdout.is_empty(), "nothing should reach stdout: {stdout}");
6868
}
69+
70+
#[test]
71+
fn version_reports_the_binary_name_and_the_package_version() {
72+
let output = match Command::new(env!("CARGO_BIN_EXE_llm-stream"))
73+
.arg("--version")
74+
.stdin(Stdio::null())
75+
.output()
76+
{
77+
Ok(output) => output,
78+
Err(e) => panic!("could not run the llm-stream binary: {e}"),
79+
};
80+
81+
let stdout = String::from_utf8_lossy(&output.stdout);
82+
let expected = format!("llm-stream {}", env!("CARGO_PKG_VERSION"));
83+
84+
// `CARGO_PKG_VERSION` here is the test's own package — the same one the
85+
// binary is built from — so this stays true across version bumps without
86+
// anyone remembering to edit it.
87+
assert_eq!(stdout.trim(), expected, "stdout: {stdout}");
88+
}

0 commit comments

Comments
 (0)