mirror of
https://git.nickiel.net/Nickiel/nicks_nextcloud_integrations.git
synced 2025-06-29 11:41:19 -07:00
added time_tracker utility
This commit is contained in:
parent
6cc989eb4c
commit
0782e7194e
6 changed files with 452 additions and 15 deletions
|
@ -2,7 +2,7 @@ use clap::Parser;
|
|||
use log::{debug, error, warn};
|
||||
use reqwest::blocking::Client;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{process::Command, path::PathBuf};
|
||||
use std::{path::PathBuf, process::Command};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let args = CliArgs::parse();
|
||||
|
@ -63,11 +63,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
let mut drive_temps: Vec<String> = vec![];
|
||||
|
||||
for drive in drives {
|
||||
let output = match Command::new("hddtemp")
|
||||
.arg("--unit=F")
|
||||
.arg(&drive)
|
||||
.output()
|
||||
{
|
||||
let output = match Command::new("hddtemp").arg("--unit=F").arg(&drive).output() {
|
||||
Ok(val) => String::from_utf8_lossy(&val.stdout).into_owned(),
|
||||
Err(e) => {
|
||||
warn!("Error running hddtemp: {e}");
|
||||
|
@ -89,17 +85,14 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
Client::new()
|
||||
.put(format!(
|
||||
"https://{}/index.php/apps/notes/api/v1/notes/{}",
|
||||
&cfg.server_url,
|
||||
&cfg.note_id
|
||||
&cfg.server_url, &cfg.note_id
|
||||
))
|
||||
.header("Accept", "application/json")
|
||||
.header("Content-Type", "application/json")
|
||||
.basic_auth(&cfg.user, Some(&cfg.pswd))
|
||||
.body(
|
||||
serde_json::to_string(&NoteUpdate {
|
||||
content: body_content,
|
||||
})?,
|
||||
)
|
||||
.body(serde_json::to_string(&NoteUpdate {
|
||||
content: body_content,
|
||||
})?)
|
||||
.send()?;
|
||||
|
||||
Ok(())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue