diff options
author | fxqnlr <[email protected]> | 2024-06-18 14:38:48 +0200 |
---|---|---|
committer | fxqnlr <[email protected]> | 2024-06-18 14:38:48 +0200 |
commit | 3df6bc8f1a2ecec1313bd9b36ff7283f840b8308 (patch) | |
tree | f780cf73a1a41de6a9314c6e5a6d1fa07fb8c37a /src/config.rs | |
parent | b375657e660b199127a76683980a5d210a572ab7 (diff) | |
download | webol-cli-args.tar webol-cli-args.tar.gz webol-cli-args.zip |
add server and secret as argumentsargs
Diffstat (limited to 'src/config.rs')
-rw-r--r-- | src/config.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/config.rs b/src/config.rs index 01ab097..cd0b1c3 100644 --- a/src/config.rs +++ b/src/config.rs | |||
@@ -1,5 +1,7 @@ | |||
1 | use serde::Deserialize; | 1 | use serde::Deserialize; |
2 | 2 | ||
3 | use crate::cli::Args; | ||
4 | |||
3 | #[derive(Deserialize)] | 5 | #[derive(Deserialize)] |
4 | pub struct Config { | 6 | pub struct Config { |
5 | pub server: String, | 7 | pub server: String, |
@@ -45,4 +47,14 @@ impl Config { | |||
45 | 47 | ||
46 | build.try_deserialize() | 48 | build.try_deserialize() |
47 | } | 49 | } |
50 | |||
51 | pub fn cli_override(&mut self, cli: &Args) -> &Self { | ||
52 | if let Some(server) = cli.server.to_owned() { | ||
53 | self.server = server | ||
54 | } | ||
55 | if let Some(secret) = cli.secret.to_owned() { | ||
56 | self.auth.secret = secret | ||
57 | } | ||
58 | self | ||
59 | } | ||
48 | } | 60 | } |