This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
[package]
|
||||
name = "kiln-cli"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
license.workspace = true
|
||||
publish.workspace = true
|
||||
|
||||
[[bin]]
|
||||
name = "kiln"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
kiln-core = { version = "=0.0.1", path = "../kiln-core" }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,36 @@
|
||||
//! Private smoke CLI for the Project Kiln workspace.
|
||||
|
||||
use std::env;
|
||||
use std::process::ExitCode;
|
||||
|
||||
use kiln_core::CONTRACT_SCHEMA_VERSION;
|
||||
|
||||
const HELP: &str = "Project Kiln private scaffold\n\nUSAGE:\n kiln <COMMAND>\n\nCOMMANDS:\n version Print the private build version\n doctor [--json] Check the scaffold contract\n help Print this help\n";
|
||||
|
||||
fn main() -> ExitCode {
|
||||
let mut arguments = env::args().skip(1);
|
||||
match (arguments.next().as_deref(), arguments.next().as_deref()) {
|
||||
(None | Some("help" | "--help" | "-h"), None) => {
|
||||
print!("{HELP}");
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
(Some("version" | "--version" | "-V"), None) => {
|
||||
println!("kiln {} (private placeholder)", env!("CARGO_PKG_VERSION"));
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
(Some("doctor"), None) => {
|
||||
println!("ok: core contract schema {CONTRACT_SCHEMA_VERSION}");
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
(Some("doctor"), Some("--json")) => {
|
||||
println!(
|
||||
"{{\"schema_version\":{CONTRACT_SCHEMA_VERSION},\"status\":\"ok\",\"private_placeholder\":true}}"
|
||||
);
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
_ => {
|
||||
eprintln!("error: unsupported arguments\n\n{HELP}");
|
||||
ExitCode::from(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user