···3233A simple CLI to listen to radio stations"#,
34 )
00035 .subcommand_required(true)
36 .subcommand(
37 Command::new("search")
···46 .subcommand(
47 Command::new("browse")
48 .about("Browse radio stations")
49- .arg(arg!([category] "The category (category name or id) to browse")),
0050 )
51 .subcommand(
52 Command::new("server")
···70 }
71 Some(("browse", args)) => {
72 let category = args.value_of("category");
73- browse::exec(category).await?;
00000000074 }
75 Some(("server", args)) => {
76 let port = args.value_of("port").unwrap();
···3233A simple CLI to listen to radio stations"#,
34 )
35+ .arg(
36+ arg!(-p --provider "The radio provider to use, can be 'tunein' or 'radiobrowser'. Default is 'tunein'").default_value("tunein")
37+ )
38 .subcommand_required(true)
39 .subcommand(
40 Command::new("search")
···49 .subcommand(
50 Command::new("browse")
51 .about("Browse radio stations")
52+ .arg(arg!([category] "The category (category name or id) to browse"))
53+ .arg(arg!(--offset "The offset to start from").default_value("0"))
54+ .arg(arg!(--limit "The number of results to show").default_value("100")),
55 )
56 .subcommand(
57 Command::new("server")
···75 }
76 Some(("browse", args)) => {
77 let category = args.value_of("category");
78+ let offset = args.value_of("offset").unwrap();
79+ let limit = args.value_of("limit").unwrap();
80+ let provider = matches.value_of("provider").unwrap();
81+ browse::exec(
82+ category,
83+ offset.parse::<u32>()?,
84+ limit.parse::<u32>()?,
85+ provider,
86+ )
87+ .await?;
88 }
89 Some(("server", args)) => {
90 let port = args.value_of("port").unwrap();