+init cargo project +readme +roadmap
This commit is contained in:
parent
cad6911742
commit
a0bd458b52
1353
Cargo.lock
generated
1353
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -4,9 +4,7 @@ version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
crossterm = "0.27.0"
|
||||
ratatui = "0.27.0"
|
||||
rodio = "0.19.0"
|
||||
clap = { version = "4.5.9", features = ["cargo"] }
|
||||
|
||||
[profile.release]
|
||||
opt-level = "z"
|
||||
|
@ -1,6 +1,7 @@
|
||||
# Roadmap
|
||||
|
||||
- [] Write backend
|
||||
- [] Write frontend
|
||||
- [] Play songs from YouTube
|
||||
- [] Manage playlists
|
||||
- [] Download
|
||||
|
||||
Pretty simple
|
||||
|
44
src/main.rs
44
src/main.rs
@ -1,3 +1,43 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use clap::{arg, command, value_parser, Arg, ArgAction, Command};
|
||||
|
||||
const HELP: &str = "\
|
||||
Koe
|
||||
|
||||
Usage: koe <COMMAND>
|
||||
|
||||
Commands:
|
||||
play Play song(s) with supplied query(s)
|
||||
list Manage a playlist
|
||||
download Download a song to an mp3
|
||||
|
||||
Options:
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
";
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// println!("aslkdm");
|
||||
let cli_matches = command!()
|
||||
.propagate_version(true)
|
||||
.subcommand_required(true)
|
||||
.arg_required_else_help(true)
|
||||
.subcommand(
|
||||
Command::new("play")
|
||||
.about("plays song from query")
|
||||
.arg(Arg::new("query").short('q').long("query"))
|
||||
.arg(Arg::new("id").long("id")),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
match cli_matches.subcommand() {
|
||||
Some(("play", sub_matches)) => {
|
||||
let id = sub_matches.get_one::<String>("id");
|
||||
let query = sub_matches.get_one::<String>("query");
|
||||
if id.is_some() && query.is_some() {
|
||||
panic!("Error: not allowed to use both query and id flags at the same time.")
|
||||
}
|
||||
}
|
||||
_ => unreachable!("Exhausted list of subcommands and subcommand_required prevents `None`"),
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
0
src/play.rs
Normal file
0
src/play.rs
Normal file
Loading…
Reference in New Issue
Block a user