mirror of
https://github.com/aramperes/nut-rs.git
synced 2025-09-09 05:28:31 -04:00
parent
f22867d2d2
commit
3002b4de53
11 changed files with 171 additions and 75 deletions
|
@ -41,15 +41,23 @@ fn main() -> anyhow::Result<()> {
|
|||
.arg(
|
||||
Arg::with_name("debug")
|
||||
.short("D")
|
||||
.long("debug")
|
||||
.takes_value(false)
|
||||
.help("Enables debug mode (logs network commands to stderr)."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("ssl")
|
||||
.short("S")
|
||||
.long("ssl")
|
||||
.takes_value(false)
|
||||
.help("Enables SSL on the connection with upsd."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("insecure-ssl")
|
||||
.long("insecure-ssl")
|
||||
.takes_value(false)
|
||||
.help("Disables SSL verification on the connection with upsd."),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("upsd-server")
|
||||
.required(false)
|
||||
|
@ -70,13 +78,15 @@ fn main() -> anyhow::Result<()> {
|
|||
)?;
|
||||
|
||||
let debug = args.is_present("debug");
|
||||
let ssl = args.is_present("ssl");
|
||||
let insecure_ssl = args.is_present("insecure-ssl");
|
||||
let ssl = insecure_ssl || args.is_present("ssl");
|
||||
|
||||
let host = server.try_into()?;
|
||||
let config = nut_client::ConfigBuilder::new()
|
||||
.with_host(host)
|
||||
.with_debug(debug)
|
||||
.with_ssl(ssl)
|
||||
.with_insecure_ssl(insecure_ssl)
|
||||
.build();
|
||||
|
||||
if args.is_present("list") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue