use std::error::Error;

use argh::FromArgs;

/// Manage `hostile` config
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "config")]
pub struct Args {
    /// config operation
    #[argh(subcommand)]
    subcommand: SubCommand,
}

#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand)]
enum SubCommand {
    Set(SetArgs),
    Unset(UnsetArgs),
    List(ListArgs),
}

/// Set a config field
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "set")]
pub struct SetArgs {
    /// config field to set
    #[argh(positional)]
    field: String,

    /// config value
    #[argh(positional)]
    value: String,
}

/// Unset a config field
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "unset")]
pub struct UnsetArgs {
    /// config field to unset
    #[argh(positional)]
    field: String,
}

/// List config fields
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand, name = "list")]
pub struct ListArgs {}

pub fn main(_: &Args) -> Result<(), Box<dyn Error>> {
    Ok(())
}
