forgot to clean up one function
This commit is contained in:
23
src/main.rs
23
src/main.rs
@ -60,7 +60,7 @@ fn run_with_input(
|
||||
"import" => import_file(client, Option::Some(value))?,
|
||||
"add_url" => add_url(client, Option::Some(value))?,
|
||||
"add_custom_name" => {
|
||||
let values: Vec<String> = vec![arguments[2].clone(), arguments[3].clone()];
|
||||
let values = (arguments[2].clone(), arguments[3].clone());
|
||||
add_artist_with_custom_name(client, Option::Some(values))?
|
||||
}
|
||||
_ => {
|
||||
@ -226,24 +226,27 @@ fn add_url(client: &mut postgres::Client, uri: Option<String>) -> Result<(), Box
|
||||
|
||||
fn add_artist_with_custom_name(
|
||||
client: &mut postgres::Client,
|
||||
uri_and_artist: Option<Vec<String>>,
|
||||
url_and_artist: Option<(String, String)>,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let mut url: String = String::new();
|
||||
let mut artist_name: String = String::new();
|
||||
let mut url = String::new();
|
||||
let mut artist_name = String::new();
|
||||
|
||||
match uri_and_artist {
|
||||
Some(vec) => {
|
||||
url = vec[0].clone();
|
||||
artist_name = vec[1].clone();
|
||||
match url_and_artist {
|
||||
Some(tuple) => {
|
||||
url = tuple.0;
|
||||
artist_name = tuple.1;
|
||||
}
|
||||
None => {
|
||||
println!("Please input the desired url");
|
||||
io::stdin().read_line(&mut url)?;
|
||||
|
||||
println!("Please input the desired artist name");
|
||||
io::stdin().read_line(&mut artist_name)?;
|
||||
}
|
||||
};
|
||||
|
||||
let url: &str = url.trim();
|
||||
let artist_name: &str = artist_name.trim();
|
||||
let url = url.trim();
|
||||
let artist_name = artist_name.trim();
|
||||
|
||||
let output = client.query_one(
|
||||
"SELECT insert_url_with_custom_artist($1, $2);",
|
||||
|
Reference in New Issue
Block a user