change spelling of seperator to separator

looks like i spelt that wrong..
This commit is contained in:
Fries 2023-07-03 16:19:45 -07:00
parent 82e8f68862
commit d6a763a90b
6 changed files with 19 additions and 19 deletions

View File

@ -8,9 +8,9 @@ pub(crate) struct Arguments {
#[arg(
long,
short,
help = "a seperator string to seperate the url from the name. defaults to : with a space after that."
help = "a separator string to seperate the url from the name. defaults to : with a space after that."
)]
pub(crate) seperator: Option<String>,
pub(crate) separator: Option<String>,
#[command(subcommand)]
pub(crate) command: Commands,
}

View File

@ -10,7 +10,7 @@ pub(crate) fn add(
path: &Path,
url: &String,
name: &Option<String>,
seperator: &String,
separator: &String,
) -> Result<(), Error> {
let names_file = names::read_names_file(path)?;
let mut names = names::load_names(names_file)?;
@ -36,7 +36,7 @@ pub(crate) fn add(
std::fs::write(path, json).unwrap();
println!(
"added {} to names.json",
site_string(&site, PrintOptions::All, seperator)
site_string(&site, PrintOptions::All, separator)
);
Ok(())

View File

@ -11,7 +11,7 @@ pub(crate) fn print(
path: &Path,
filter: &Option<String>,
group: &PrintGroup,
seperator: &String,
separator: &String,
json: bool,
) -> Result<(), Error> {
let names_file = names::read_names_file(path)?;
@ -25,7 +25,7 @@ pub(crate) fn print(
data: "this url was not found in names.json".into(),
});
}
return filter_site(&names[0], json, seperator, group);
return filter_site(&names[0], json, separator, group);
}
for site in names {
@ -34,7 +34,7 @@ pub(crate) fn print(
continue;
}
printing(seperator, &site, group);
printing(separator, &site, group);
}
Ok(())
@ -43,7 +43,7 @@ pub(crate) fn print(
fn filter_site(
site: &Site,
json: bool,
seperator: &String,
separator: &String,
group: &PrintGroup,
) -> Result<(), Error> {
if json {
@ -51,7 +51,7 @@ fn filter_site(
return Ok(());
}
return Ok(printing(seperator, site, group));
return Ok(printing(separator, site, group));
}
fn json_printing(site: &Site) -> Result<(), Error> {
@ -67,8 +67,8 @@ fn json_printing(site: &Site) -> Result<(), Error> {
}
}
fn printing(seperator: &String, site: &Site, group: &PrintGroup) {
let string = site_string(site, print_group_to_options(group), seperator);
fn printing(separator: &String, site: &Site, group: &PrintGroup) {
let string = site_string(site, print_group_to_options(group), separator);
println!("{}", string);
}

View File

@ -3,7 +3,7 @@ use std::path::Path;
use crate::commands::utils::{site_string, PrintOptions};
pub(crate) fn remove(path: &Path, url: &String, seperator: &String) -> Result<(), Error> {
pub(crate) fn remove(path: &Path, url: &String, separator: &String) -> Result<(), Error> {
let names_file = names::read_names_file(path)?;
let mut names = names::load_names(names_file)?;
@ -11,7 +11,7 @@ pub(crate) fn remove(path: &Path, url: &String, seperator: &String) -> Result<()
if &site.url == url {
println!(
"removing {} from names.json",
site_string(&site, PrintOptions::All, seperator)
site_string(&site, PrintOptions::All, separator)
);
}
&site.url != url

View File

@ -6,7 +6,7 @@ pub(super) enum PrintOptions {
All,
}
pub(super) fn site_string(site: &Site, options: PrintOptions, seperator: &String) -> String {
pub(super) fn site_string(site: &Site, options: PrintOptions, separator: &String) -> String {
let mut string = String::new();
if matches!(options, PrintOptions::Url) || matches!(options, PrintOptions::All) {
@ -18,7 +18,7 @@ pub(super) fn site_string(site: &Site, options: PrintOptions, seperator: &String
return string;
}
if !string.is_empty() {
string += &format!("{}{}", seperator, name)
string += &format!("{}{}", separator, name)
} else {
string += name;
}

View File

@ -13,7 +13,7 @@ fn main() -> Result<(), Error> {
let default_path = directories::get_names_path()?;
let args = Arguments::parse();
let seperator = args.seperator.unwrap_or(": ".into());
let separator = args.separator.unwrap_or(": ".into());
let path = match &args.path {
Some(path) => Path::new(path),
@ -25,9 +25,9 @@ fn main() -> Result<(), Error> {
filter,
group,
json,
} => print(path, filter, group, &seperator, *json)?,
Commands::Add { url, name } => add(path, url, name, &seperator)?,
Commands::Remove { url } => remove(path, url, &seperator)?,
} => print(path, filter, group, &separator, *json)?,
Commands::Add { url, name } => add(path, url, name, &separator)?,
Commands::Remove { url } => remove(path, url, &separator)?,
};
Ok(())