use anyhow::Result;
use clap::{Parser, Subcommand};
mod allowlist;
mod config;
mod handler;
mod hashdb;
mod inode_storage;
mod install;
mod mode;
mod privilege;
mod run;
mod setup;
mod upgrade;
pub(crate) use mode::Mode as ModeArg;
#[derive(Parser, Debug)]
#[command(
name = "linprov",
version,
about = "eBPF-based mark-of-the-web for Linux",
arg_required_else_help = true
)]
struct Cli {
#[command(subcommand)]
command: Cmd,
}
#[derive(Subcommand, Debug)]
enum Cmd {
Run(run::RunArgs),
Setup(setup::SetupArgs),
Upgrade(upgrade::UpgradeArgs),
}
fn main() -> Result<()> {
let cli = Cli::parse();
if !matches!(cli.command, Cmd::Run(_)) {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init();
}
match cli.command {
Cmd::Run(args) => run::execute(args),
Cmd::Setup(args) => setup::run(args),
Cmd::Upgrade(args) => upgrade::run(args),
}
}