Add beginnings of CLI parsing

This commit is contained in:
gil 2024-05-30 19:59:22 -05:00
parent 1091399fec
commit 76744cbe71
3 changed files with 22 additions and 8 deletions

View file

@ -2,6 +2,7 @@
name = "fediloom"
version = "0.1.0"
edition = "2021"
description = "Combines blocklists for ActivityPub software"
[dependencies]
clap = { version = "4.5.4", features = ["derive"] }

View file

@ -3,20 +3,33 @@
mod manip;
mod tests;
use std::path::PathBuf;
use clap::Parser;
#[derive(Parser)]
#[command(version, about, long_about = None)]
struct Cli {
// TODO inputs
// TODO outputs
// TODO cfg file (TOML)
// TODO options
/// Selects a custom config file (optional)
config: Option<PathBuf>,
/// Sets output directory (optional, defaults to current directory)
output_dir: Option<PathBuf>,
/// Specifies block files/directories
#[arg(short, long)]
block: Vec<PathBuf>,
/// Specifies silence files/directories
#[arg(short, long)]
mute: Vec<PathBuf>,
// TODO more options
// TODO verbose mode
//
}
fn main() {
println!("Hello, world!");
let cli = Cli::parse();
// TODO argument parsing - IN PROGRESS
// TODO logging
}

View file

@ -138,7 +138,7 @@ impl ModMap {
}
pub fn alphabetize_lines(string: String) -> String {
let mut v = string.lines().collect::<Vec<&str>>();
let mut v: Vec<&str> = string.lines().collect();
v.sort_by_key(|a| a.to_lowercase());
v.join("\n") + "\n"