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:
parent
4a7349a5fa
commit
a2719c8c7e
3 changed files with 39 additions and 2 deletions
|
@ -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" ] }
|
31
article_scraper_cli/src/args.rs
Normal file
31
article_scraper_cli/src/args.rs
Normal 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>,
|
||||
},
|
||||
}
|
|
@ -1,3 +1,8 @@
|
|||
use clap::Parser;
|
||||
|
||||
mod args;
|
||||
|
||||
pub fn main() {
|
||||
let _args = args::Args::parse();
|
||||
println!("hello world");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue