Some changes
Signed-off-by: Nikolai Rodionov <allanger@badhouseplants.net>
This commit is contained in:
@@ -6,3 +6,4 @@ edition = "2024"
|
||||
[dependencies]
|
||||
clap = { version = "4.5.45", features = ["derive"] }
|
||||
plux = { path = "../plux" }
|
||||
toml = "0.9.5"
|
||||
|
@@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user