1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
mod cfg;
mod i2impl;
mod pkgtoolkit;
#[allow(unused_imports)]
use crate::cfg::config::Config;
#[allow(unused_imports)]
use crate::pkgtoolkit::pkgtools::Package;
#[allow(unused_imports)]
use crate::i2impl::mi2p;
use clap::{Parser, Subcommand, Args};
#[derive(Parser)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
#[command(about = "Validate .mesk package archive")]
Validate {
pkgname: String,
},
#[command(about = "Build package from .mesk ")]
Build{
pkgname: String,
},
#[command(about = "Install package from remote or local sources")]
Install{
pkgname: String,
},
#[command(about = "Uninstall package")]
Uninstall{
pkgname: String,
},
#[command(about = "Get package source")]
GetSource{
pkgname: String
}
}
#[derive(Args, Clone)]
#[command(about = "Remote install arguments")]
struct RemoteInstallArgs {
verbose: bool,
debug: bool,
bin: bool,
source: bool,
i2p: bool,
}
fn main() -> Result<(), std::io::Error> {
let cli: Cli = Cli::parse();
// Plug in these functions only until the backend is ready for testing (Aplha versions)
// It is necessary for me to understand the I/O model of the future mesk.
match &cli.command {
Commands::Validate { pkgname } => {
println!("Validating {}", pkgname);
return Ok(())
},
Commands::Build { pkgname } => {
println!("Building {}", pkgname);
return Ok(())
},
Commands::Install { pkgname } => {
println!("Installing {}", pkgname);
return Ok(())
},
Commands::Uninstall { pkgname } => {
println!("Uninstalling {}", pkgname);
return Ok(())
},
Commands::GetSource { pkgname } => {
println!("Getting source of {}", pkgname);
return Ok(())
}
}
Ok(())
}
|