mdq/src/args.rs

28 lines
1,004 B
Rust
Raw Normal View History

2023-10-25 16:33:12 +02:00
use clap::{arg, command, ArgMatches};
pub fn get_args() -> ArgMatches {
command!()
.about("Query markdown files")
.arg(arg!([dir] "Directory to scan").required(true))
.arg(arg!(-j --json "Output result as JSON").required(false))
2023-10-26 13:09:30 +02:00
.arg(
arg!(-l --limit <LIMIT> "Limit number of results returned")
.required(false)
.default_value("0")
.allow_negative_numbers(false),
)
.arg(
arg!(--offset <OFFSET> "Offset results by a factor. Useful when used with --limit")
.required(false)
.allow_negative_numbers(false)
.default_value("0"),
)
2023-10-25 16:33:12 +02:00
.arg(arg!(-f --filter <FILTER>... "Filter to apply to the documents").required(false))
.arg(
arg!(-c --column <COLUMN>... "Specify output columns")
.required(false)
.default_value("file.title:Title"),
2023-10-25 16:33:12 +02:00
)
.get_matches()
}