mirror of
https://github.com/002Hub/IPass.git
synced 2025-04-19 22:01:21 +02:00
better messages
add "build" shortcut for windows
This commit is contained in:
parent
de70fedbdf
commit
1801ca34c6
23
src/main.rs
23
src/main.rs
@ -5,7 +5,7 @@ use std::io::Write;
|
|||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let version = "0.1.1";
|
let version = "0.1.2";
|
||||||
println!("IPass v{}\n", version);
|
println!("IPass v{}\n", version);
|
||||||
|
|
||||||
let args = utils::get_args();
|
let args = utils::get_args();
|
||||||
@ -35,7 +35,7 @@ fn version_help(version: &str) {
|
|||||||
let mut data = version.split(".");
|
let mut data = version.split(".");
|
||||||
print!("Major {} ", data.next().unwrap());
|
print!("Major {} ", data.next().unwrap());
|
||||||
print!("Sub {} ", data.next().unwrap());
|
print!("Sub {} ", data.next().unwrap());
|
||||||
print!("Bugfix {}", data.next().unwrap());
|
println!("Bugfix {}", data.next().unwrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn help_message(args: &Vec<String>) {
|
fn help_message(args: &Vec<String>) {
|
||||||
@ -97,9 +97,17 @@ fn help_message(args: &Vec<String>) {
|
|||||||
fn list() {
|
fn list() {
|
||||||
let paths = std::fs::read_dir(utils::get_ipass_folder()).unwrap();
|
let paths = std::fs::read_dir(utils::get_ipass_folder()).unwrap();
|
||||||
|
|
||||||
|
let mut has_entry:bool = false;
|
||||||
|
|
||||||
for path in paths {
|
for path in paths {
|
||||||
|
has_entry = true;
|
||||||
println!("Entry: \"{}\"", path.unwrap().file_name().into_string().unwrap().replace(".ipass", ""));
|
println!("Entry: \"{}\"", path.unwrap().file_name().into_string().unwrap().replace(".ipass", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !has_entry {
|
||||||
|
println!("No entries yet!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn add(args: &Vec<String>) {
|
fn add(args: &Vec<String>) {
|
||||||
@ -121,7 +129,6 @@ fn add(args: &Vec<String>) {
|
|||||||
let mut chars = String::new();
|
let mut chars = String::new();
|
||||||
|
|
||||||
for index in chars_index {
|
for index in chars_index {
|
||||||
// println!("index: {index} : {}",(index%((alphabet.len()-1) as u8)));
|
|
||||||
chars += &char_set[(index%((alphabet.len()-1) as u8)) as usize].to_string();
|
chars += &char_set[(index%((alphabet.len()-1) as u8)) as usize].to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +242,7 @@ fn import(args: &Vec<String>) {
|
|||||||
file.write_all(i.as_bytes()).unwrap();
|
file.write_all(i.as_bytes()).unwrap();
|
||||||
name = "";
|
name = "";
|
||||||
}
|
}
|
||||||
print!("Imported all entries!");
|
println!("Imported all entries!");
|
||||||
} else {
|
} else {
|
||||||
println!("No such file found!");
|
println!("No such file found!");
|
||||||
}
|
}
|
||||||
@ -264,8 +271,12 @@ fn export(args: &Vec<String>) { //TODO: compress data
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut file = std::fs::File::create(location.clone()+"/export.ipassx").unwrap();
|
if let Ok(mut file) = std::fs::File::create(location.clone()+"/export.ipassx") {
|
||||||
file.write_all(collected_data.as_bytes()).unwrap();
|
file.write_all(collected_data.as_bytes()).unwrap();
|
||||||
|
|
||||||
println!("Saved at: {}/export.ipassx", location);
|
println!("Saved at: '{}/export.ipassx'", location);
|
||||||
|
} else {
|
||||||
|
println!("Failed saving at '{}/export.ipassx' does it exist?",location)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user