updated hotreload branch

This commit is contained in:
Paul Lecuq 2021-10-19 13:57:07 +02:00
parent 8dcdc017e0
commit 8c9575b6bd
3 changed files with 7 additions and 7 deletions

2
Cargo.lock generated
View File

@ -1232,7 +1232,7 @@ dependencies = [
[[package]] [[package]]
name = "zabbixlaunch" name = "zabbixlaunch"
version = "0.1.0" version = "1.0.0"
dependencies = [ dependencies = [
"clap", "clap",
"embedded-graphics", "embedded-graphics",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "zabbixlaunch" name = "zabbixlaunch"
version = "0.1.0" version = "1.0.0"
edition = "2018" edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

View File

@ -1,7 +1,7 @@
use clap::{App, Arg, ArgMatches}; use clap::{App, Arg, ArgMatches};
use nix::sys::inotify::{AddWatchFlags, InitFlags, Inotify}; use nix::sys::inotify::{AddWatchFlags, InitFlags, Inotify};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Error; use serde_json::Error as JsonError;
use std::string::String; use std::string::String;
use std::thread::sleep; use std::thread::sleep;
use std::time::Duration; use std::time::Duration;
@ -51,7 +51,7 @@ impl Context {
} }
pub fn argparse() -> ArgMatches<'static> { pub fn argparse() -> ArgMatches<'static> {
App::new("Zabbix Launch") App::new("Zabbix Launch")
.version("1.0") .version("1.0.0")
.author("PaulBSD <paul@paulbsd.com>") .author("PaulBSD <paul@paulbsd.com>")
.about("Lights up Launchpad mini using Zabbix data") .about("Lights up Launchpad mini using Zabbix data")
.arg( .arg(
@ -116,7 +116,7 @@ impl<'a> Config {
let filemeta = std::fs::metadata(configfile); let filemeta = std::fs::metadata(configfile);
let fileexists = match filemeta { let fileexists = match filemeta {
Ok(_) => true, Ok(_) => true,
Err(_err) => false, Err(_) => false,
}; };
if !fileexists { if !fileexists {
@ -132,10 +132,10 @@ impl<'a> Config {
}; };
let mut contents = String::new(); let mut contents = String::new();
file.read_to_string(&mut contents).unwrap(); file.read_to_string(&mut contents).unwrap();
let parse: Result<Config, Error> = serde_json::from_str(contents.as_str()); let parse: Result<Config, JsonError> = serde_json::from_str(contents.as_str());
let cfg = match parse { let cfg = match parse {
Ok(cfg) => cfg, Ok(cfg) => cfg,
Err(_e) => Config::new(), Err(_) => Config::new(),
}; };
*self = cfg; *self = cfg;
if self.feed_missing() { if self.feed_missing() {