Skip to content

Commit

Permalink
Udpate clap to v3.2.21
Browse files Browse the repository at this point in the history
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert committed Sep 15, 2022
1 parent 92f7abf commit 261d5c9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
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

0 comments on commit 261d5c9

Please sign in to comment.