Browse Source

better logs and promts

db-refactoring
Coin de Gamma 4 months ago
parent
commit
e1b194d599
  1. 13
      src/main.rs

13
src/main.rs

@ -47,7 +47,8 @@ fn init() -> io::Result<()> {
fs::File::create(STORAGE_PATH)?; fs::File::create(STORAGE_PATH)?;
println!("Storage db created"); println!("Storage db created");
println!("Initialization complete. It's required to add folder `{}` under git manually.", STORAGE_FOLDER); println!("Initialization complete.");
println!("Now it's required to add folder `{}` under git manually. Don't worry it's going to be encrypted", STORAGE_FOLDER);
Ok(()) Ok(())
} }
@ -92,7 +93,8 @@ fn main() -> io::Result<()> {
} }
None => { None => {
if !is_inited() { if !is_inited() {
println!("Do you want to init your storage? [Y/n]"); print!("Do you want to init your storage? [Y/n] ");
io::stdout().flush().expect("Failed to flush stdout");
let mut input = String::new(); let mut input = String::new();
io::stdin() io::stdin()
.read_line(&mut input) .read_line(&mut input)
@ -100,7 +102,12 @@ fn main() -> io::Result<()> {
let input = input.trim().to_lowercase(); let input = input.trim().to_lowercase();
match input.as_str() { match input.as_str() {
"y" => init()?, "y" => init()?,
"n" => println!("You chose No."), "n" => {
println!("mps can work only when storage inited.");
println!("Hint: you cant do");
println!(" git clone <your_storage_git_url> {}", STORAGE_FOLDER);
println!("to init manually your storage and config")
},
_ => init()?, _ => init()?,
} }
} else { } else {

Loading…
Cancel
Save