1use clap::{Arg, ArgMatches, Command};
2pub async fn cli() -> Result<ArgMatches, Box<dyn std::error::Error>> {
3 let matches = Command::new("gnostr-query")
4 .about("Construct nostr queries and send them over a websocket")
5 .arg(
6 Arg::new("authors")
7 .short('a')
8 .long("authors")
9 .help("Comma-separated list of authors"),
10 )
11 .arg(
12 Arg::new("mentions")
13 .short('p')
14 .long("mentions")
15 .help("Comma-separated list of mentions"),
16 )
17 .arg(
18 Arg::new("references")
19 .short('e')
20 .long("references")
21 .help("Comma-separated list of references"),
22 )
23 .arg(
24 Arg::new("hashtag")
25 .short('t')
26 .long("hashtag")
27 .help("Comma-separated list of hashtags"),
28 )
29 .arg(
30 Arg::new("ids")
31 .short('i')
32 .long("ids")
33 .help("Comma-separated list of ids"),
34 )
35 .arg(
36 Arg::new("kinds")
37 .short('k')
38 .long("kinds")
39 .help("Comma-separated list of kinds (integers)"),
40 )
41 .arg(
42 Arg::new("generic")
43 .short('g')
44 .long("generic")
45 .value_names(["tag", "value"])
46 .number_of_values(2)
47 .help("Generic tag query: #<tag>: value"),
48 )
49 .arg(
50 Arg::new("limit")
51 .short('l')
52 .long("limit")
53 .value_parser(clap::value_parser!(i32))
54 .default_value("1")
55 .help("Limit the number of results"),
56 )
57 .arg(
58 Arg::new("relay")
59 .short('r')
60 .long("relay")
61 .required(false)
62 .default_value("wss://relay.damus.io"),
64 )
65 .arg(
66 Arg::new("search").short('s').long("search").required(false), )
69 .get_matches();
70
71 Ok(matches)
72}