[feat] introduced server and cli crates with foundational HTTP server and CLI implementation, including routing, health check, and configuration setup

This commit is contained in:
2025-08-20 09:58:21 +02:00
parent 16167d18ff
commit d37daf02f6
12 changed files with 457 additions and 1275 deletions

View File

@@ -0,0 +1,57 @@
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(default)]
pub struct Cli {
#[serde(default)]
pub default_output: DefaultOutput,
#[serde(default = "Cli::default_pager_command")]
pub pager_command: String,
#[serde(default = "Cli::default_show_progress")]
pub show_progress: bool,
#[serde(default = "Cli::default_auto_confirm_bulk")]
pub auto_confirm_bulk: bool,
#[serde(default = "Cli::default_show_geographic_hierarchy")]
pub show_geographic_hierarchy: bool,
}
impl Default for Cli {
fn default() -> Self {
Self {
default_output: DefaultOutput::Table,
pager_command: Self::default_pager_command(),
show_progress: Self::default_show_progress(),
auto_confirm_bulk: Self::default_auto_confirm_bulk(),
show_geographic_hierarchy: Self::default_show_geographic_hierarchy(),
}
}
}
#[derive(Deserialize, Serialize, Debug, Clone)]
#[serde(rename_all = "snake_case")]
pub enum DefaultOutput {
Table,
Json,
}
impl Default for DefaultOutput {
fn default() -> Self {
DefaultOutput::Table
}
}
impl Cli {
pub fn default_pager_command() -> String {
// Example default; customize as needed
"less -R".to_string()
}
pub fn default_show_progress() -> bool {
true
}
pub fn default_auto_confirm_bulk() -> bool {
false
}
pub fn default_show_geographic_hierarchy() -> bool {
true
}
}