forked from 1b-agent/fieldcraft-upstream
cli: fieldcraft-cli --version
The release packaging runs it to check each build (#72). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NmAttHhUZTokgPeEJia8sm
This commit is contained in:
1 parent
8caa0d15cb
commit
8172af67e7
2 files changed
+18
No files matched your search
@@ -2,6 +2,7 @@
|
|||||||
//! fieldcraft-cli run <script.json>
|
//! fieldcraft-cli run <script.json>
|
||||||
//! fieldcraft-cli features
|
//! fieldcraft-cli features
|
||||||
//! fieldcraft-cli mcp [--connect ADDR | --headless] [--automation-read-root DIR] [--automation-write-root DIR]
|
//! fieldcraft-cli mcp [--connect ADDR | --headless] [--automation-read-root DIR] [--automation-write-root DIR]
|
||||||
|
//! fieldcraft-cli --version
|
||||||
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
|
|
||||||
@@ -26,6 +27,7 @@ usage:
|
|||||||
--automation-read-root DIR files may be read only inside DIR
|
--automation-read-root DIR files may be read only inside DIR
|
||||||
--automation-write-root DIR files may be written only inside DIR (with either root,
|
--automation-write-root DIR files may be written only inside DIR (with either root,
|
||||||
the access a root left out is not granted)
|
the access a root left out is not granted)
|
||||||
|
fieldcraft-cli --version print the version
|
||||||
";
|
";
|
||||||
|
|
||||||
/// Largest script accepted (bytes).
|
/// Largest script accepted (bytes).
|
||||||
@@ -46,6 +48,10 @@ fn main() -> ExitCode {
|
|||||||
}
|
}
|
||||||
Some("mcp") => mcp(args.get(1..).unwrap_or(&[])),
|
Some("mcp") => mcp(args.get(1..).unwrap_or(&[])),
|
||||||
Some("run") => args.get(1).ok_or_else(|| format!("run needs a script\n\n{USAGE}")).and_then(|p| run(p)),
|
Some("run") => args.get(1).ok_or_else(|| format!("run needs a script\n\n{USAGE}")).and_then(|p| run(p)),
|
||||||
|
Some("-V" | "--version") => {
|
||||||
|
println!("fieldcraft-cli {}", env!("CARGO_PKG_VERSION"));
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
Some("-h" | "--help" | "help") | None => {
|
Some("-h" | "--help" | "help") | None => {
|
||||||
print!("{USAGE}");
|
print!("{USAGE}");
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
//! `fieldcraft-cli --version`, which the release packaging runs to check each build.
|
||||||
|
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn version_prints_the_workspace_version() {
|
||||||
|
for flag in ["--version", "-V"] {
|
||||||
|
let out = Command::new(env!("CARGO_BIN_EXE_fieldcraft-cli")).arg(flag).output().unwrap();
|
||||||
|
assert!(out.status.success(), "{flag}: {out:?}");
|
||||||
|
assert_eq!(String::from_utf8_lossy(&out.stdout).trim(), format!("fieldcraft-cli {}", env!("CARGO_PKG_VERSION")));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user