From d2b3ddc2dfb81e40c61dfc74ef20a2070cd34849 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Tue, 10 Jul 2018 10:34:37 +0200 Subject: [PATCH] implement feedback --- Cargo.toml | 2 +- src/lib.rs | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 196dcdb..ae3867c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.2-alpha.0" license = "MIT OR Apache-2.0" repository = "https://github.com/rust-clique/clap-port-flag" documentation = "https://docs.rs/clap-port-flag" -description = "Easily add a --port flag to CLIs using Structopt" +description = "Easily add a --port flag to CLIs using Structopt." authors = ["Yoshua Wuyts "] readme = "README.md" diff --git a/src/lib.rs b/src/lib.rs index a4f4894..d239cdd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -31,18 +31,22 @@ use std::os::unix::io::FromRawFd; /// ``` #[derive(StructOpt, Debug)] pub struct Port { + /// The hostname to listen to. Can be any string that can be parsed to an + /// IpAddr, including IPv6. #[structopt(short = "H", long = "hostname", default_value = "127.0.0.1")] hostname: String, + /// The network port to listen to. #[structopt(short = "p", long = "port", env = "PORT", group = "bind")] port: Option, - #[structopt(long = "file-descriptor", env = "LISTEN_FD", group = "bind")] + /// A previously opened network socket. + #[structopt(long = "listen-fd", env = "LISTEN_FD", group = "bind")] fd: Option, } /// Create a TCP socket. /// /// ## Panics -/// If a file descriptor Was passed directly, we call the unsafe +/// If a file descriptor was passed directly, we call the unsafe /// `TcpListener::from_raw_fd()` method, which may panic if a non-existent file /// descriptor was passed. impl Port {