tiny progress
This commit is contained in:
32
src/main.rs
32
src/main.rs
@ -20,10 +20,10 @@ fn run_as_cli() {
|
||||
let mut client = Client::connect("host=192.168.0.10 port=28945 user=hentai password=h99nqaNPhpfbuuhCDwQXLpZAnoVTjSQP7taoqmQhpzc2rPLVC4JUAKxAHfuuhuU9", NoTls).unwrap();
|
||||
let mut option: String = String::new();
|
||||
|
||||
loop {
|
||||
show_usage();
|
||||
println!("Please input any of these options or type \'exit\' to leave");
|
||||
show_usage();
|
||||
println!("Please input any of these options or type \'exit\' to leave");
|
||||
|
||||
loop {
|
||||
io::stdin()
|
||||
.read_line(&mut option)
|
||||
.expect("Failed to read input");
|
||||
@ -39,7 +39,7 @@ fn run_as_cli() {
|
||||
"add_custom_name" => add_artist_with_custom_name(&mut client, None),
|
||||
"exit" => break,
|
||||
_ => {
|
||||
println!("Invalid option!");
|
||||
eprintln!("Invalid option!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -63,7 +63,7 @@ fn run_with_input(arguments: Vec<String>) {
|
||||
let values: Vec<String> = vec![arguments[2].clone(), arguments[3].clone()];
|
||||
add_artist_with_custom_name(&mut client, Option::Some(values))
|
||||
}
|
||||
_ => panic!("Invalid argument"),
|
||||
_ => eprintln!("Invalid argument"),
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,15 +85,17 @@ fn generate_file(client: &mut postgres::Client, website: Option<String>) {
|
||||
|
||||
let result: bool = output.get(0);
|
||||
if result == false {
|
||||
panic!("Invalid website_name");
|
||||
eprintln!("Invalid website_name");
|
||||
return;
|
||||
}
|
||||
|
||||
let filename = format!("{website_name}_generated.txt");
|
||||
let mut file = match File::create(filename) {
|
||||
let mut file = match File::create_new(filename) {
|
||||
Ok(file) => file,
|
||||
Err(error) => {
|
||||
let message = error.to_string();
|
||||
panic!("Problem opening the file: {message}");
|
||||
eprintln!("Problem creating the file: {message}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
@ -122,11 +124,12 @@ fn convert_folders(client: &mut postgres::Client, path: Option<String>) {
|
||||
};
|
||||
|
||||
let filename: &str = "convert_folders.log";
|
||||
let mut log_file = match File::create(filename) {
|
||||
let mut log_file = match File::create_new(filename) {
|
||||
Ok(file) => file,
|
||||
Err(error) => {
|
||||
let message = error.to_string();
|
||||
panic!("Problem opening the file: {message}");
|
||||
eprintln!("Problem creating the file: {message}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
@ -169,11 +172,12 @@ fn import_file(client: &mut postgres::Client, file: Option<String>) {
|
||||
let input_file = File::open(filename).unwrap();
|
||||
let reader_iter = BufReader::new(input_file).lines();
|
||||
|
||||
let mut fucked_file = match File::create("Fucked.txt") {
|
||||
let mut fucked_file = match File::create_new("Fucked.txt") {
|
||||
Ok(file) => file,
|
||||
Err(error) => {
|
||||
let message = error.to_string();
|
||||
panic!("Problem opening the file: {message}");
|
||||
eprintln!("Problem creating the file: {message}");
|
||||
return;
|
||||
}
|
||||
};
|
||||
writeln!(fucked_file, "Them are hella fucked").unwrap();
|
||||
@ -210,7 +214,7 @@ fn add_url(client: &mut postgres::Client, uri: Option<String>) {
|
||||
|
||||
let result: i32 = output.get(0);
|
||||
if result == 1 {
|
||||
panic!("HELP!!!");
|
||||
eprintln!("Database didn\'t like your input");
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,7 +247,7 @@ fn add_artist_with_custom_name(client: &mut postgres::Client, uri_and_artist: Op
|
||||
|
||||
let result: i32 = output.get(0);
|
||||
if result == 1 {
|
||||
panic!("HELP!!!");
|
||||
eprintln!("Database didn\'t like your input");
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user