Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Udpate clap to v3.2.21 #719

Merged
merged 1 commit into from
Sep 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion conmon-rs/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ anyhow = "1.0.65"
capnp = "0.14.9"
capnp-rpc = "0.14.1"
conmon-common = { path = "../common" }
clap = { version = "3.1.17", features = ["cargo", "derive", "env", "wrap_help"] }
clap = { version = "3.2.21", features = ["cargo", "derive", "env", "wrap_help"] }
futures = "0.3.24"
getset = "0.1.2"
serde = { version = "1.0.144", features = ["derive"] }
Expand Down
11 changes: 9 additions & 2 deletions conmon-rs/server/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub struct Config {

#[get = "pub"]
#[clap(
default_value_if("version", None, Some("")),
default_value(""),
env(concat!(prefix!(), "RUNTIME")),
long("runtime"),
short('r'),
Expand All @@ -73,7 +73,7 @@ pub struct Config {

#[get = "pub"]
#[clap(
default_value_if("version", None, Some("")),
default_value(""),
env(concat!(prefix!(), "RUNTIME_DIR")),
long("runtime-dir"),
value_name("RUNTIME_DIR")
Expand Down Expand Up @@ -171,6 +171,13 @@ const PIDFILE: &str = "pidfile";
impl Config {
/// Validate the configuration integrity.
pub fn validate(&self) -> Result<()> {
if self.runtime().as_os_str().is_empty() {
bail!("--runtime flag not set")
}
if self.runtime_dir().as_os_str().is_empty() {
bail!("--runtime-dir flag not set")
}

if !self.runtime().exists() {
bail!("runtime path '{}' does not exist", self.runtime().display())
}
Expand Down