Added manual specification of interfaces
This commit is contained in:
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user