Skip to content

Commit

Permalink
add basic version command to shim
Browse files Browse the repository at this point in the history
Signed-off-by: Rajat Jindal <[email protected]>
  • Loading branch information
rajatjindal committed Apr 15, 2024
1 parent aa1d186 commit c99ec71
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions containerd-shim-spin/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,18 @@ use containerd_shim_wasm::{
container::Instance,
sandbox::cli::{revision, shim_main, version},
};
use std::env;

mod engine;
mod version;

fn main() {
let args: Vec<String> = env::args().collect();
if args.len() > 1 && args[1] == "--version" {
version::print_version();
return;
}

// Configure the shim to have only error level logging for performance improvements.
let shim_config = Config {
default_log_level: "error".to_string(),
Expand Down
5 changes: 5 additions & 0 deletions containerd-shim-spin/src/version.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const VERSION: &'static str = env!("CARGO_PKG_VERSION");

pub fn print_version() {
println!("{}", VERSION);
}

0 comments on commit c99ec71

Please sign in to comment.