hai/src/main.rs

77 lines
1.5 KiB
Rust
Raw Normal View History

2025-02-19 00:08:36 +01:00
/*
* SPDX-FileCopyrightText: 2025 April Faye John <april.john@denic.de> & Contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // hide console window on Windows in release
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
mod gui;
mod bininfo;
2025-02-20 14:04:16 +01:00
mod pman;
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
use clap::{Subcommand, Parser};
2025-02-20 14:04:16 +01:00
use pman::init_process_manager;
2025-02-19 00:08:36 +01:00
use shadow_rs::shadow;
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
shadow!(build);
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
/// Simple program to greet a person
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
struct Args {
/// Name of the person to greet
//#[arg(short, long)]
//name: String,
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
/// Number of times to greet
//#[arg(short, long, default_value_t = 1)]
//count: u8,
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
#[command(subcommand)]
command: Commands,
}
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
#[derive(Debug, Subcommand)]
enum Commands {
#[command(arg_required_else_help = true, about = "todo replace this cmd")]
Clone {
/// The remote to clone
remote: String,
},
#[command(about = "List compile time backed info to audit binary")]
Shadow {
outfile: Option<String>,
},
2025-02-20 14:04:16 +01:00
#[command(about = "Show test gui")]
Gui,
2020-08-21 02:47:38 +02:00
}
2025-02-19 00:08:36 +01:00
fn main() {
let args = Args::parse();
2020-08-21 02:47:38 +02:00
2025-02-20 14:04:16 +01:00
init_process_manager();
2025-02-19 00:08:36 +01:00
match args.command {
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
Commands::Clone { remote } => {
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
}
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
Commands::Shadow { outfile } => {
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
bininfo::print_info();
return;
2020-08-21 02:47:38 +02:00
2025-02-19 00:08:36 +01:00
}
2025-02-20 14:04:16 +01:00
Commands::Gui => {
let res = gui::gui_main();
if let Err(e) = res {
println!("{}", e);
}
}
2025-02-19 00:08:36 +01:00
2025-02-20 14:04:16 +01:00
};
2020-08-21 02:47:38 +02:00
}