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 d8ed139827
commit 6f9e896592
6 changed files with 19 additions and 19 deletions

View File

@ -8,9 +8,9 @@ pub(crate) struct Arguments {
#[arg( #[arg(
long, long,
short, 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)] #[command(subcommand)]
pub(crate) command: Commands, pub(crate) command: Commands,
} }

View File

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

View File

@ -11,7 +11,7 @@ pub(crate) fn print(
path: &Path, path: &Path,
filter: &Option<String>, filter: &Option<String>,
group: &PrintGroup, group: &PrintGroup,
seperator: &String, separator: &String,
json: bool, json: bool,
) -> Result<(), Error> { ) -> Result<(), Error> {
let names_file = names::read_names_file(path)?; 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(), 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 { for site in names {
@ -34,7 +34,7 @@ pub(crate) fn print(
continue; continue;
} }
printing(seperator, &site, group); printing(separator, &site, group);
} }
Ok(()) Ok(())
@ -43,7 +43,7 @@ pub(crate) fn print(
fn filter_site( fn filter_site(
site: &Site, site: &Site,
json: bool, json: bool,
seperator: &String, separator: &String,
group: &PrintGroup, group: &PrintGroup,
) -> Result<(), Error> { ) -> Result<(), Error> {
if json { if json {
@ -51,7 +51,7 @@ fn filter_site(
return Ok(()); return Ok(());
} }
return Ok(printing(seperator, site, group)); return Ok(printing(separator, site, group));
} }
fn json_printing(site: &Site) -> Result<(), Error> { 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) { fn printing(separator: &String, site: &Site, group: &PrintGroup) {
let string = site_string(site, print_group_to_options(group), seperator); let string = site_string(site, print_group_to_options(group), separator);
println!("{}", string); println!("{}", string);
} }

View File

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

View File

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

View File

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