Added manual specification of interfaces

This commit is contained in:
Random936
2024-09-22 19:44:12 -07:00
parent 121f6d6417
commit 1f7f636219
5 changed files with 753 additions and 8 deletions

View File

@@ -0,0 +1,26 @@
use std::env;
use clap::Parser;
fn current_dir_as_string() -> String {
env::current_dir()
.unwrap()
.into_os_string()
.into_string()
.unwrap()
}
#[derive(Parser, Debug)]
#[command(version, about, long_about = None)]
pub struct Args {
/// Interface to print URLs for. Default is all interfaces.
#[arg(short, long, default_value_t = String::from("all"))]
pub interface: String,
/// Directory to serve. Default is your current working directory.
#[arg(short, long, default_value_t = current_dir_as_string())]
pub directory: String,
}
pub fn parse_args() -> Args {
Args::parse()
}