+init cargo project +readme +roadmap

This commit is contained in:
nuru 2024-07-20 02:46:08 +00:00
parent cad6911742
commit a0bd458b52
Signed by: nuru
GPG Key ID: FA028981DC86855A
5 changed files with 107 additions and 1299 deletions

1353
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -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"

View File

@ -1,6 +1,7 @@
# Roadmap
- [] Write backend
- [] Write frontend
- [] Play songs from YouTube
- [] Manage playlists
- [] Download
Pretty simple

View File

@ -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
View File