mirror of
https://github.com/msfjarvis/clipboard-substitutor
synced 2025-08-14 22:27:03 +05:30
refactor: switch to argv for argument handling
This commit is contained in:
parent
1a1e97722b
commit
a5c22063cd
3 changed files with 10 additions and 6 deletions
|
@ -3,7 +3,6 @@ mod config;
|
|||
#[cfg(test)]
|
||||
mod test;
|
||||
|
||||
use std::ops::Deref;
|
||||
use std::path::PathBuf;
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
|
@ -12,8 +11,6 @@ use dirs::config_dir;
|
|||
use crate::clipboard::monitor_clipboard;
|
||||
use crate::config::Replacements;
|
||||
|
||||
const VERSION_ARGS: [&str; 3] = ["version", "-v", "--version"];
|
||||
|
||||
fn main() -> Result<()> {
|
||||
if check_for_version_arg() {
|
||||
return Ok(());
|
||||
|
@ -28,9 +25,8 @@ fn main() -> Result<()> {
|
|||
}
|
||||
|
||||
fn check_for_version_arg() -> bool {
|
||||
let args: Vec<String> = std::env::args().collect();
|
||||
for arg in args {
|
||||
if VERSION_ARGS.contains(&arg.deref()) {
|
||||
for arg in argv::iter() {
|
||||
if arg == "-v" || arg == "version" || arg == "--version" {
|
||||
print_version();
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue