|
|
@ -78,6 +78,13 @@ impl MPS { |
|
|
|
MPS { storage: None } |
|
|
|
MPS { storage: None } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn print_init_hint() { |
|
|
|
|
|
|
|
println!("1. Create empty repository for storing your passwords on gitlab or somewhere you prefer"); |
|
|
|
|
|
|
|
println!("2. Clone to your home folder ~/.mps/storage"); |
|
|
|
|
|
|
|
println!("3. Set variable $MPS_HOME=\"~/.mps/\""); |
|
|
|
|
|
|
|
println!("4. Add to your $PATH:<path_to_msp> where you installed your mps"); |
|
|
|
|
|
|
|
println!("5. Run mps init"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn prompt_new_password() -> io::Result<String> { |
|
|
|
fn prompt_new_password() -> io::Result<String> { |
|
|
|
print!("Enter passphrase for storage: "); |
|
|
|
print!("Enter passphrase for storage: "); |
|
|
@ -191,7 +198,6 @@ impl MPS { |
|
|
|
format!("Can`t find id: {}", id) |
|
|
|
format!("Can`t find id: {}", id) |
|
|
|
)); |
|
|
|
)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let item = st.get(id); |
|
|
|
let item = st.get(id); |
|
|
|
editor::open_to_show(&item.content)?; |
|
|
|
editor::open_to_show(&item.content)?; |
|
|
|
Ok(()) |
|
|
|
Ok(()) |
|
|
@ -224,7 +230,7 @@ fn run_command() -> io::Result<()> { |
|
|
|
if !Storage::is_inited()? { |
|
|
|
if !Storage::is_inited()? { |
|
|
|
match get_prompt("Do you want to init your storage?")? { |
|
|
|
match get_prompt("Do you want to init your storage?")? { |
|
|
|
PROMPT::YES => MPS::init()?, |
|
|
|
PROMPT::YES => MPS::init()?, |
|
|
|
PROMPT::NO => Storage::print_init_hint()?, |
|
|
|
PROMPT::NO => MPS::print_init_hint(), |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
let mut mps = MPS::new(); |
|
|
|
let mut mps = MPS::new(); |
|
|
|