1
0
Fork 0
mirror of https://gitlab.com/news-flash/article_scraper.git synced 2025-07-07 08:05:31 +02:00

first few cli args

This commit is contained in:
Jan Lukas Gernert 2023-04-05 08:43:00 +02:00
parent 4a7349a5fa
commit a2719c8c7e
3 changed files with 39 additions and 2 deletions

View file

@ -8,4 +8,5 @@ description = "Cli to use the article_scraper lib"
repository = "https://gitlab.com/news-flash/article_scraper"
[dependencies]
article_scraper = { path = "../article_scraper/" }
article_scraper = { path = "../article_scraper/" }
clap = { version = "4.2", features = [ "derive" ] }

View file

@ -0,0 +1,31 @@
use clap::{command, Parser, Subcommand};
use std::path::PathBuf;
#[derive(Parser)]
#[command(author, version, about, long_about = None)]
pub struct Args {
/// Turn debug logging on
#[arg(short, long)]
debug: bool,
#[command(subcommand)]
command: Option<Commands>,
/// Destination of resulting HTML file
#[arg(short, long, value_name = "FILE")]
output: Option<PathBuf>,
}
#[derive(Subcommand)]
enum Commands {
/// Only use the Readability parser
Readability {
/// Source HTML file
#[arg(long, value_name = "FILE")]
html: Option<PathBuf>,
/// Source Url
#[arg(long, value_name = "URL")]
source_url: Option<String>,
},
}

View file

@ -1,3 +1,8 @@
use clap::Parser;
mod args;
pub fn main() {
let _args = args::Args::parse();
println!("hello world");
}
}