summaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs37
1 files changed, 20 insertions, 17 deletions
diff --git a/src/main.rs b/src/main.rs
index c38d265..463bd24 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,14 +1,13 @@
mod cfg;
-mod i2impl;
+mod net;
mod pkgtoolkit;
use crate::cfg::config::Config;
#[allow(unused_imports)]
use crate::pkgtoolkit::pkgtools::Package;
-use crate::i2impl::mi2p::I2P;
+use crate::net::i2p_package::I2PPackage;
use clap::{Args, Command, Parser, Subcommand};
-use yosemite::Stream;
use std::io::Write;
use std::path::Path;
use std::fs::create_dir_all;
@@ -41,6 +40,9 @@ enum Commands {
Install{
pkgname: String,
source: Option<String>,
+ #[command(flatten)]
+ args: RemoteInstallArgs
+
},
#[command(about = "Uninstall package")]
Uninstall{
@@ -62,12 +64,13 @@ enum Commands {
#[derive(Args, Clone)]
#[command(about = "Remote install arguments")]
-struct RemoteInstallArgs {
- verbose: bool,
- debug: bool,
+struct RemoteInstallArgs {
+ #[arg(short = 'b', long = "bin" )]
bin: bool,
- source: bool,
- i2p: bool,
+ #[arg(short = 'h', long = "http" )]
+ http: bool,
+ #[arg(short = 'c', long = "clean" )]
+ clean: bool
}
#[tokio::main]
@@ -85,7 +88,7 @@ async fn main() -> Result<(), std::io::Error> {
println!("Building {}", pkgname);
return Ok(())
},
- Commands::Install { pkgname, source} => {
+ Commands::Install { pkgname, source, args} => {
println!("Installing {}", pkgname);
return Ok(())
},
@@ -109,9 +112,9 @@ async fn main() -> Result<(), std::io::Error> {
log::warn!("Writing the default config to /etc/mesk/mesk.toml");
let path = Path::new("/etc/mesk/mesk.toml");
- create_dir_all(path.parent().unwrap()).unwrap();
- let mut file = File::create(path).unwrap();
- file.write(config.as_bytes()).unwrap();
+ create_dir_all(path.parent().unwrap())?;
+ let mut file = File::create(path)?;
+ file.write(config.as_bytes())?;
println!("Config tool ending work.");
} else {
@@ -124,9 +127,9 @@ async fn main() -> Result<(), std::io::Error> {
log::warn!("Writing the default config to /etc/mesk/mesk.toml");
let path = Path::new("/etc/mesk/mesk.toml");
- create_dir_all(path.parent().unwrap()).unwrap();
- let mut file = File::create(path).unwrap();
- file.write_all(config.as_bytes()).unwrap();
+ create_dir_all(path.parent().unwrap())?;
+ let mut file = File::create(path)?;
+ file.write_all(config.as_bytes())?;
println!("Config tool ending work.");
}
@@ -135,8 +138,8 @@ async fn main() -> Result<(), std::io::Error> {
Commands::Update => {
let config = Config::parse().unwrap();
println!("Updating index from {}", config.repo.repo_url);
- let mut i2pd = I2P::new(config);
- let _index= I2P::fetch_index(&mut i2pd).await?;
+ let mut i2pd = I2PPackage::new(config);
+ let _index= I2PPackage::fetch_index(&mut i2pd).await?;
println!("Index updated");
return Ok(())
},