Some changes

Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
2025-08-16 06:09:09 +02:00
parent bd4b186368
commit 9b768689d2
4 changed files with 25 additions and 16 deletions

View File

@@ -6,3 +6,4 @@ edition = "2024"
[dependencies]
clap = { version = "4.5.45", features = ["derive"] }
plux = { path = "../plux" }
toml = "0.9.5"

View File

@@ -1,6 +1,6 @@
use std::{path::PathBuf};
use clap::{Parser, Subcommand};
use plux::collection;
use plux::{collection, config};
#[derive(Parser)]
#[command(version, about, long_about = None)]
@@ -28,6 +28,11 @@ enum Commands {
subcommands: CollectionCommands,
},
Plugin,
Config {
#[command(subcommand)]
subcommands: ConfigCommands,
}
}
#[derive(Subcommand)]
@@ -37,6 +42,10 @@ enum CollectionCommands {
url: String
},
}
#[derive(Subcommand)]
enum ConfigCommands {
Show
}
fn run(url: &str) {
collection::add_collection(url.to_string());
@@ -77,7 +86,19 @@ fn main() {
CollectionCommands::Add { url } => run(&url),
},
Commands::Plugin => todo!(),
Commands::Config { subcommands } => match subcommands {
ConfigCommands::Show => show_config(),
},
}
// Continued program logic goes here...
}
fn show_config() {
let cfg = match config::read_config() {
Ok(res) => res,
Err(e) => todo!(),
};
let cfg_toml = toml::to_string(&cfg).unwrap();
println!("{}", cfg_toml)
}