parse_args: cleanup
Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -14,14 +14,8 @@ use viperus::Viperus;
|
|||||||
/// Parse the commandline arguments and preset default values
|
/// Parse the commandline arguments and preset default values
|
||||||
/// Precedence: defaults -> config-file -> environment -> commandline
|
/// Precedence: defaults -> config-file -> environment -> commandline
|
||||||
pub fn parse_args(viperus: &mut Viperus) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn parse_args(viperus: &mut Viperus) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
if cfg!(feature = "global") {
|
if cfg!(feature = "parse_cli") {
|
||||||
trace!(target: "Viperus", "Viperus feature 'global' enabled.");
|
trace!(target: "Viperus", "Enabled parsing features.");
|
||||||
println!("Lasy static: 'VIPERUS' is accessible globaly");
|
|
||||||
}
|
|
||||||
|
|
||||||
if cfg!(feature = "fmt-clap") {
|
|
||||||
trace!(target: "Viperus", "Viperus feature 'fmt-clap' enabled.");
|
|
||||||
println!("Using feature fmt-clap");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(proj_dirs) = ProjectDirs::from("de", "Networkx GmbH", "advotracker") {
|
if let Some(proj_dirs) = ProjectDirs::from("de", "Networkx GmbH", "advotracker") {
|
||||||
@@ -29,7 +23,7 @@ pub fn parse_args(viperus: &mut Viperus) -> Result<(), Box<dyn std::error::Error
|
|||||||
// Lin: $HOME/.config/advotracker
|
// Lin: $HOME/.config/advotracker
|
||||||
// Win: C:\Users\%USERNAME%\AppData\Roaming\Networkx GmbH\advotracker\config
|
// Win: C:\Users\%USERNAME%\AppData\Roaming\Networkx GmbH\advotracker\config
|
||||||
// Mac: /Users/$USER/Library/Application Support/de.Networkx-GmbH.advotracker
|
// Mac: /Users/$USER/Library/Application Support/de.Networkx-GmbH.advotracker
|
||||||
trace!(target: "ProjectDirs", "Viperus feature 'fmt-clap' enabled.");
|
trace!(target: "ProjectDirs", "Read from target-os defaults direcories.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(proj_dirs) = ProjectDirs::from("de", "Networkx GmbH", "advotracker") {
|
if let Some(proj_dirs) = ProjectDirs::from("de", "Networkx GmbH", "advotracker") {
|
||||||
@@ -199,11 +193,15 @@ SMR Unerledigt: 089 92529 60222",
|
|||||||
);
|
);
|
||||||
println!(
|
println!(
|
||||||
"to_email_address: {:?}",
|
"to_email_address: {:?}",
|
||||||
viperus.get::<String>("to_email_address").unwrap_or_default()
|
viperus
|
||||||
|
.get::<String>("to_email_address")
|
||||||
|
.unwrap_or_default()
|
||||||
);
|
);
|
||||||
println!(
|
println!(
|
||||||
"from_email_address: {:?}",
|
"from_email_address: {:?}",
|
||||||
viperus.get::<String>("from_email_address").unwrap_or_default()
|
viperus
|
||||||
|
.get::<String>("from_email_address")
|
||||||
|
.unwrap_or_default()
|
||||||
);
|
);
|
||||||
println!(
|
println!(
|
||||||
"test_policy_number: {:?}",
|
"test_policy_number: {:?}",
|
||||||
|
|||||||
Reference in New Issue
Block a user