chore: clean-up code

This commit is contained in:
IndyV 2022-11-05 15:37:18 +01:00
parent 44e9ff4bff
commit 09a6f70487
2 changed files with 3 additions and 15 deletions

View File

@ -43,14 +43,10 @@ struct Tags {
}
pub async fn handler(pathflag: Option<PathBuf>) -> Result<()> {
// If a pathflag is Some() it means it's passed via a flag, use that path and skip the prompting
// Otherwise, prompt the user to select a default path (depending on type of installation), or tinyfiledialog for a path, or manual input
// Either gets the pathflag or prompts the user for a path
let path = match pathflag {
Some(pathflag) => pathflag,
None => prompt_history_file().ok_or(eyre::eyre!(
"No path provided, please provide a path to your ShareX history file"
"No path provided. Please provide a path to your ShareX history file."
))?,
};
@ -210,7 +206,6 @@ async fn delete_urls(deletion_urls: Result<Vec<String>>) -> Result<()> {
}
let progress_bar = util::setup_progressbar(deletion_urls.len());
// progress_bar.enable_steady_tick(Duration::from_millis(500)); // This only visually updates the ticker once every 500ms instead of when the tick occurs
let client = reqwest::Client::new();

View File

@ -49,17 +49,10 @@ pub fn open_webpage(url: &str) {
open::that(url).unwrap_or_else(|_| panic!("Unable to open webpage {}", &url));
}
// Check if ran with Clap arguments or not
pub fn is_interactive() -> bool {
let args = Args::parse();
match args.command {
None => {
// No command provided, running in interactive mode
true
}
_ => {
// Command provided, running in non-interactive mode
false
}
None => true,
_ => false,
}
}