Some changes

Signed-off-by: Nikolai Rodionov <nikolai.rodionov@onpier.de>
This commit is contained in:
Nikolai Rodionov
2025-08-16 05:13:57 +02:00
parent 912c517433
commit bd4b186368
7 changed files with 500 additions and 24 deletions

View File

@@ -1,5 +1,6 @@
use std::path::PathBuf;
use std::{path::PathBuf};
use clap::{Parser, Subcommand};
use plux::collection;
#[derive(Parser)]
#[command(version, about, long_about = None)]
@@ -16,23 +17,38 @@ struct Cli {
debug: u8,
#[command(subcommand)]
command: Option<Commands>,
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
/// does testing things
Collection {},
Collection {
#[command(subcommand)]
subcommands: CollectionCommands,
},
Plugin,
}
#[derive(Subcommand)]
enum CollectionCommands {
Add {
#[arg(short, long, value_name = "URL")]
url: String
},
}
fn run(url: &str) {
collection::add_collection(url.to_string());
}
fn main() {
let config = match plux::config::read_config() {
Ok(res) => res,
Err(err) => panic!("Something didn't work",),
};
println!("{:?}", config);
println!("fuck you");
let cli = Cli::parse();
// You can check the value provided by positional arguments, or option arguments
@@ -57,11 +73,10 @@ fn main() {
// You can check for the existence of subcommands, and if found use their
// matches just as you would the top level cmd
match &cli.command {
Some(Commands::Collection { }) => {
println!("Not printing testing lists...");
}
None => {}
Commands::Collection { subcommands } => match subcommands {
CollectionCommands::Add { url } => run(&url),
},
Commands::Plugin => todo!(),
}
// Continued program logic goes here...