From 3dd26a785403c7b50623d154ac6f07ff363cca47 Mon Sep 17 00:00:00 2001 From: utam0k Date: Tue, 8 Oct 2024 13:02:34 +0900 Subject: [PATCH] crate/youki: Set the default features Signed-off-by: utam0k --- crates/youki/Cargo.toml | 2 ++ crates/youki/src/commands/info.rs | 24 ++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/crates/youki/Cargo.toml b/crates/youki/Cargo.toml index a8ee044f2..0acefd17e 100644 --- a/crates/youki/Cargo.toml +++ b/crates/youki/Cargo.toml @@ -11,7 +11,9 @@ edition = "2021" build = "build.rs" keywords = ["youki", "container"] +# Don't forget to update info command. [features] +default = ["systemd", "v2", "v1", "seccomp"] systemd = ["libcgroups/systemd", "libcontainer/systemd", "v2"] v2 = ["libcgroups/v2", "libcontainer/v2"] v1 = ["libcgroups/v1", "libcontainer/v1"] diff --git a/crates/youki/src/commands/info.rs b/crates/youki/src/commands/info.rs index 4a92b1ac4..465f3987b 100644 --- a/crates/youki/src/commands/info.rs +++ b/crates/youki/src/commands/info.rs @@ -27,9 +27,29 @@ pub fn info(_: Info) -> Result<()> { } /// print Version of Youki +#[allow(clippy::vec_init_then_push)] pub fn print_youki() { - println!("{:<18}{}", "Version", env!("CARGO_PKG_VERSION")); - println!("{:<18}{}", "Commit", env!("VERGEN_GIT_SHA")); + println!("{:<16}", "Build"); + println!(" {:<16}{}", "Version", env!("CARGO_PKG_VERSION")); + println!(" {:<16}{}", "Commit", env!("VERGEN_GIT_SHA")); + let mut enabled_features: Vec<&str> = Vec::new(); + #[cfg(feature = "systemd")] + enabled_features.push("systemd"); + #[cfg(feature = "v1")] + enabled_features.push("v1"); + #[cfg(feature = "v2")] + enabled_features.push("v2"); + #[cfg(feature = "cgroupsv2_devices")] + enabled_features.push("cgroupsv2_devices"); + #[cfg(feature = "seccomp")] + enabled_features.push("seccomp"); + #[cfg(feature = "wasm-wasmer")] + enabled_features.push("wasm-wasmer"); + #[cfg(feature = "wasm-wasmedge")] + enabled_features.push("wasm-wasmedge"); + #[cfg(feature = "wasm-wasmtime")] + enabled_features.push("wasm-wasmtime"); + println!(" {:<16}{}", "Features", enabled_features.join(", ")); } /// Print Kernel Release, Version and Architecture