Skip to content

Commit 8007f3d

Browse files
canyugsclaude
andcommitted
feat: add --version / -V flag
Print `openab <version>` from CARGO_PKG_VERSION and exit. No new dependencies — uses existing std::env::args() parsing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ac5a8a5 commit 8007f3d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/main.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@ async fn main() -> anyhow::Result<()> {
2121
)
2222
.init();
2323

24-
let config_path = std::env::args()
25-
.nth(1)
24+
let first_arg = std::env::args().nth(1);
25+
if matches!(first_arg.as_deref(), Some("--version") | Some("-V")) {
26+
println!("openab {}", env!("CARGO_PKG_VERSION"));
27+
return Ok(());
28+
}
29+
30+
let config_path = first_arg
2631
.map(PathBuf::from)
2732
.unwrap_or_else(|| PathBuf::from("config.toml"));
2833

0 commit comments

Comments
 (0)