Skip to content

Commit

Permalink
refactor: update .gitignore and Cargo.toml, and remove unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
Kremilly committed Oct 28, 2024
1 parent 5b5564f commit afb31d4
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 19 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ Cargo.lock
/target

.env
.idea
8 changes: 7 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
name = "dumpsync"
version = "0.1.0"
edition = "2021"
license = "MIT"
authors = ["kremilly"]
keywords = ["mysql", "dump", "restore", "backup"]
description = "A simple tool for dump and restore a MySQL database. It can be used for backup and restore purposes, or for transferring a database from one server to another."
repository = "https://github.com/kremilly/DumpSync"
documentation = "https://kremilly.com/docs/dumpsync"
homepage = "https://kremilly.com"

[dependencies]
chrono = "0.4.38"
Expand All @@ -11,4 +18,3 @@ ctrlc = "3.4.5"
dotenvy = "0.15.7"
figlet-rs = "0.1.5"
rand = "0.8.5"
uuid = { version = "1.11.0", features = ["v4"] }
2 changes: 1 addition & 1 deletion src/dumpsync.rs → src/dump_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ impl DumpSync {
Env::get_var("DS_DUMP_PATH")
};

UI::label("Press CTRL+C to exit the tool", "info");
UI::label("Press CTRL+C to exit the tool", "normal");

UI::section_header("Dumping the database", "info");

Expand Down
4 changes: 2 additions & 2 deletions src/engine/dump.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ use crate::{

pub struct Dump {
user: String,
password: String,
dbname: String,
interval: u64,
dbname: String,
password: String,
dump_file_path: String,
}

Expand Down
4 changes: 0 additions & 4 deletions src/engine/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,4 @@ impl Env {
env::var(var).expect(&format!("{} is not defined in the .env", var)).parse().expect(&format!("{} is not a valid number", var))
}

pub fn get_var_bool(var: &str) -> bool {
env::var(var).expect(&format!("{} is not defined in the .env", var)).parse().expect(&format!("{} is not a valid boolean", var))
}

}
4 changes: 2 additions & 2 deletions src/engine/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pub mod dump;
pub mod env;
pub mod env;
pub mod dump;
12 changes: 6 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
pub mod ui;
pub mod utils;
pub mod engine;
pub mod args_cli;
pub mod dumpsync;
mod ui;
mod utils;
mod engine;
mod args_cli;
mod dump_sync;

use dumpsync::DumpSync;
use crate::dump_sync::DumpSync;

fn main() {
DumpSync::init();
Expand Down
13 changes: 10 additions & 3 deletions src/ui/ui_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ impl UI {

if let Some(title) = standard_font.convert(&name) {
println!("{}", &title.to_string().bold().cyan());

println!(
"Version: {} | Author: {} | License: {} | Home: {}",

env!("CARGO_PKG_VERSION").bold().green(),
env!("CARGO_PKG_AUTHORS").bold().cyan(),
env!("CARGO_PKG_LICENSE").bold().blue(),
env!("CARGO_PKG_HOMEPAGE").bold().yellow()
);
}
}

pub fn section_header(text: &str, level: &str) {
let text = text.to_uppercase();
let message = Self::colorize(&text, level);

let message = Self::colorize(&text.to_uppercase(), level);
println!("\n{}\n", message);
}

Expand Down

0 comments on commit afb31d4

Please sign in to comment.