Add beginnings of CLI parsing
This commit is contained in:
parent
1091399fec
commit
76744cbe71
|
@ -2,6 +2,7 @@
|
||||||
name = "fediloom"
|
name = "fediloom"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
description = "Combines blocklists for ActivityPub software"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clap = { version = "4.5.4", features = ["derive"] }
|
clap = { version = "4.5.4", features = ["derive"] }
|
||||||
|
|
25
src/main.rs
25
src/main.rs
|
@ -3,20 +3,33 @@
|
||||||
mod manip;
|
mod manip;
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
|
|
||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
|
#[command(version, about, long_about = None)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
// TODO inputs
|
/// Selects a custom config file (optional)
|
||||||
// TODO outputs
|
config: Option<PathBuf>,
|
||||||
// TODO cfg file (TOML)
|
|
||||||
// TODO options
|
/// 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
|
// TODO verbose mode
|
||||||
//
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println!("Hello, world!");
|
let cli = Cli::parse();
|
||||||
|
|
||||||
// TODO argument parsing - IN PROGRESS
|
// TODO argument parsing - IN PROGRESS
|
||||||
// TODO logging
|
// TODO logging
|
||||||
}
|
}
|
|
@ -138,7 +138,7 @@ impl ModMap {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn alphabetize_lines(string: String) -> String {
|
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.sort_by_key(|a| a.to_lowercase());
|
||||||
|
|
||||||
v.join("\n") + "\n"
|
v.join("\n") + "\n"
|
||||||
|
|
Loading…
Reference in a new issue