the mize bin works
This commit is contained in:
@@ -7,7 +7,6 @@ use std::ffi::OsString;
|
||||
use std::path::PathBuf;
|
||||
use std::process::exit;
|
||||
|
||||
use colored::Colorize;
|
||||
use mize::error::{MizeError, MizeResult};
|
||||
use mize::item::ItemData;
|
||||
use mize::platform::os::logging::init_logger;
|
||||
@@ -15,11 +14,6 @@ use mize::{instance, Mize};
|
||||
use std::env;
|
||||
use std::io::Write;
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::{mpsc, Mutex};
|
||||
use tracing::level_filters::LevelFilter;
|
||||
use tracing::Level;
|
||||
use tracing_subscriber::filter::EnvFilter;
|
||||
use tracing_subscriber::fmt::Subscriber;
|
||||
|
||||
use tracing::{debug, error, info, trace, warn};
|
||||
|
||||
@@ -38,41 +32,18 @@ fn main() {
|
||||
|
||||
// match command
|
||||
let result = match cli_matches.subcommand() {
|
||||
// mi daemon
|
||||
Some(("daemon", sub_matches)) => cli::daemon(sub_matches),
|
||||
|
||||
Some(("is-running", sub_matches)) => cli::is_running(sub_matches),
|
||||
|
||||
// mi serve
|
||||
Some(("serve", sub_matches)) => cli::stop(sub_matches),
|
||||
|
||||
// mi mount
|
||||
Some(("mount", sub_matches)) => cli::mount(sub_matches),
|
||||
|
||||
// mi get
|
||||
Some(("run", sub_matches)) => cli::run(sub_matches),
|
||||
Some(("status", sub_matches)) => cli::status(sub_matches),
|
||||
Some(("info", sub_matches)) => cli::info(sub_matches),
|
||||
|
||||
Some(("get", sub_matches)) => cli::get(sub_matches),
|
||||
|
||||
// mi set
|
||||
Some(("set", sub_matches)) => cli::set(sub_matches),
|
||||
|
||||
// mi show
|
||||
Some(("show", sub_matches)) => cli::show(sub_matches),
|
||||
|
||||
// mi call
|
||||
Some(("call", sub_matches)) => cli::call(sub_matches),
|
||||
|
||||
// mi create
|
||||
Some(("create", sub_matches)) => cli::create(sub_matches),
|
||||
|
||||
// mi gui
|
||||
Some(("gui", sub_matches)) => cli::gui(sub_matches),
|
||||
|
||||
// mi format-cbor
|
||||
Some(("format-cbor", sub_matches)) => cli::format_cbor(sub_matches),
|
||||
|
||||
// some unknown command passed
|
||||
Some((cmd, sub_matches)) => cli::run_from_module(cmd, sub_matches),
|
||||
|
||||
|
||||
Some((cmd, sub_matches)) => cli::run_from_part(cmd, sub_matches),
|
||||
None => Err(MizeError::new()
|
||||
.msg("No subcommand was passed. use --help to list availavle comamnds.")),
|
||||
};
|
||||
@@ -87,7 +58,7 @@ fn cli_matches() -> clap::ArgMatches {
|
||||
let main = Command::new(APPNAME)
|
||||
.version(crate_version!())
|
||||
.author("Sebastian Moser")
|
||||
.about("The MiZe Command line tool")
|
||||
.about("MiZe")
|
||||
.allow_external_subcommands(true)
|
||||
.arg(
|
||||
Arg::new("verbose")
|
||||
@@ -104,35 +75,30 @@ fn cli_matches() -> clap::ArgMatches {
|
||||
.global(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("silent")
|
||||
.long("silent")
|
||||
.action(ArgAction::SetTrue)
|
||||
.help("set the log-level to OFF")
|
||||
.global(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("folder")
|
||||
.short('f')
|
||||
.long("folder")
|
||||
.help("The folder the Instance stores all it's data and the socket for connections")
|
||||
Arg::new("log")
|
||||
.long("log")
|
||||
.help("log file to use")
|
||||
.global(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("config")
|
||||
.short('c')
|
||||
.long("config")
|
||||
.help("overwrite config options")
|
||||
.help("config file path")
|
||||
.global(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("config-file")
|
||||
.long("config-file")
|
||||
.help("specify a config file")
|
||||
Arg::new("secrets")
|
||||
.long("secrets")
|
||||
.help("file path to store secrets at")
|
||||
.global(true),
|
||||
)
|
||||
.arg(
|
||||
Arg::new("opt")
|
||||
.short('o')
|
||||
.long("opt")
|
||||
.help("overwrite a config option")
|
||||
.global(true),
|
||||
)
|
||||
.subcommand(Command::new("daemon").about("Run a MiZe Instance as a daemon"))
|
||||
.subcommand(Command::new("stop").about("Stop a MiZe Instance"))
|
||||
.subcommand(Command::new("mount").aliases(["m"]))
|
||||
.subcommand(
|
||||
Command::new("get")
|
||||
.aliases(["g"])
|
||||
@@ -152,9 +118,9 @@ fn cli_matches() -> clap::ArgMatches {
|
||||
)
|
||||
.subcommand(Command::new("call").aliases(["c"]))
|
||||
.subcommand(Command::new("create").aliases(["cr"]))
|
||||
.subcommand(Command::new("is-running").aliases(["isr"]))
|
||||
.subcommand(Command::new("gui"))
|
||||
.subcommand(Command::new("format-cbor"))
|
||||
.subcommand(Command::new("status").aliases(["st"]))
|
||||
.subcommand(Command::new("run"))
|
||||
.subcommand(Command::new("format-cbor").aliases(["fc"]))
|
||||
.arg_required_else_help(true);
|
||||
|
||||
return main.get_matches();
|
||||
|
||||
Reference in New Issue
Block a user