Skip to content

Commit

Permalink
Update release pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
tbsklg committed Aug 18, 2024
1 parent 2b91c9e commit 40485e0
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 7 additions & 2 deletions cli-client/src/local_client.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
use serde_json::Value;
use serde_json::{json, Value};

pub fn add_strike(name: &str, db_path: &std::path::PathBuf) -> Value {
let db = std::fs::read_to_string(db_path).unwrap_or_else(|_| "{}".to_string());
let db = std::fs::read_to_string(db_path).unwrap_or_else(|_| json!({}).to_string());
let updated_db = update_strikes(name, serde_json::from_str(&db).unwrap());

if !db_path.exists() {
std::fs::create_dir_all(db_path.parent().unwrap()).unwrap();
}

std::fs::write(db_path, serde_json::to_string_pretty(&updated_db).unwrap()).unwrap();

updated_db
2 changes: 0 additions & 2 deletions cli-client/src/main.rs
Original file line number Diff line number Diff line change
@@ -49,8 +49,6 @@ async fn main() {
|local| local.db_path,
));

println!("{:?}", db_path);

match args.command.unwrap() {
Command::Strike { name } => {
add_strike(&name, &db_path);

0 comments on commit 40485e0

Please sign in to comment.