mirror of
https://github.com/house-of-vanity/khm.git
synced 2025-07-08 07:44:08 +00:00
Fix metadata
This commit is contained in:
65
src/main.rs
65
src/main.rs
@ -1,5 +1,5 @@
|
||||
mod server;
|
||||
mod client;
|
||||
mod server;
|
||||
|
||||
use clap::Parser;
|
||||
use env_logger;
|
||||
@ -9,8 +9,8 @@ use env_logger;
|
||||
/// In client mode, it sends keys to the server and can update the known_hosts file with keys from the server.
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(
|
||||
author = "Your Name",
|
||||
version = "1.0",
|
||||
author = env!("CARGO_PKG_AUTHORS"),
|
||||
version = env!("CARGO_PKG_VERSION"),
|
||||
about = "SSH Key Manager",
|
||||
long_about = None,
|
||||
after_help = "Examples:\n\
|
||||
@ -22,33 +22,64 @@ use env_logger;
|
||||
khm --host http://kh.example.com:8080 --known_hosts ~/.ssh/known_hosts --in-place\n\
|
||||
\n\
|
||||
"
|
||||
)]struct Args {
|
||||
)]
|
||||
struct Args {
|
||||
/// IP address to bind the server or client to (default: 127.0.0.1)
|
||||
#[arg(short, long, default_value = "127.0.0.1", help = "Server mode: IP address to bind the server to")]
|
||||
#[arg(
|
||||
short,
|
||||
long,
|
||||
default_value = "127.0.0.1",
|
||||
help = "Server mode: IP address to bind the server to"
|
||||
)]
|
||||
ip: String,
|
||||
|
||||
/// Port to bind the server or client to (default: 8080)
|
||||
#[arg(short, long, default_value = "8080", help = "Server mode: Port to bind the server to")]
|
||||
#[arg(
|
||||
short,
|
||||
long,
|
||||
default_value = "8080",
|
||||
help = "Server mode: Port to bind the server to"
|
||||
)]
|
||||
port: u16,
|
||||
|
||||
/// Hostname or IP address of the PostgreSQL database (default: 127.0.0.1)
|
||||
#[arg(long, default_value = "127.0.0.1", help = "Server mode: Hostname or IP address of the PostgreSQL database")]
|
||||
#[arg(
|
||||
long,
|
||||
default_value = "127.0.0.1",
|
||||
help = "Server mode: Hostname or IP address of the PostgreSQL database"
|
||||
)]
|
||||
db_host: String,
|
||||
|
||||
/// Name of the PostgreSQL database (default: khm)
|
||||
#[arg(long, default_value = "khm", help = "Server mode: Name of the PostgreSQL database")]
|
||||
#[arg(
|
||||
long,
|
||||
default_value = "khm",
|
||||
help = "Server mode: Name of the PostgreSQL database"
|
||||
)]
|
||||
db_name: String,
|
||||
|
||||
/// Username for the PostgreSQL database (required in server mode)
|
||||
#[arg(long, required_if_eq("server", "true"), help = "Server mode: Username for the PostgreSQL database")]
|
||||
#[arg(
|
||||
long,
|
||||
required_if_eq("server", "true"),
|
||||
help = "Server mode: Username for the PostgreSQL database"
|
||||
)]
|
||||
db_user: Option<String>,
|
||||
|
||||
/// Password for the PostgreSQL database (required in server mode)
|
||||
#[arg(long, required_if_eq("server", "true"), help = "Server mode: Password for the PostgreSQL database")]
|
||||
#[arg(
|
||||
long,
|
||||
required_if_eq("server", "true"),
|
||||
help = "Server mode: Password for the PostgreSQL database"
|
||||
)]
|
||||
db_password: Option<String>,
|
||||
|
||||
/// Host address of the server to connect to in client mode (required in client mode)
|
||||
#[arg(long, required_if_eq("server", "false"), help = "Client mode: Host address of the server to connect to")]
|
||||
#[arg(
|
||||
long,
|
||||
required_if_eq("server", "false"),
|
||||
help = "Client mode: Host address of the server to connect to"
|
||||
)]
|
||||
host: Option<String>,
|
||||
|
||||
/// Run in server mode (default: false)
|
||||
@ -56,11 +87,18 @@ use env_logger;
|
||||
server: bool,
|
||||
|
||||
/// Path to the known_hosts file (default: ~/.ssh/known_hosts)
|
||||
#[arg(long, default_value = "~/.ssh/known_hosts", help = "Client mode: Path to the known_hosts file")]
|
||||
#[arg(
|
||||
long,
|
||||
default_value = "~/.ssh/known_hosts",
|
||||
help = "Client mode: Path to the known_hosts file"
|
||||
)]
|
||||
known_hosts: String,
|
||||
|
||||
/// Update the known_hosts file with keys from the server after sending keys (default: false)
|
||||
#[arg(long, help = "Server mode: Sync the known_hosts file with keys from the server")]
|
||||
#[arg(
|
||||
long,
|
||||
help = "Server mode: Sync the known_hosts file with keys from the server"
|
||||
)]
|
||||
in_place: bool,
|
||||
|
||||
/// Comma-separated list of flows to manage (default: default)
|
||||
@ -68,7 +106,6 @@ use env_logger;
|
||||
flows: Vec<String>,
|
||||
}
|
||||
|
||||
|
||||
#[actix_web::main]
|
||||
async fn main() -> std::io::Result<()> {
|
||||
env_logger::init();
|
||||
|
Reference in New Issue
Block a user