Some changes
Signed-off-by: Nikolai Rodionov <nikolai.rodionov@onpier.de>
This commit is contained in:
@@ -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...
|
||||
|
Reference in New Issue
Block a user