Skip to content

Commit

Permalink
implement feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshuawuyts committed Jul 10, 2018
1 parent c63366d commit d2b3ddc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>"]
readme = "README.md"

Expand Down
8 changes: 6 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u16>,
#[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<c_int>,
}

/// 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 {
Expand Down

0 comments on commit d2b3ddc

Please sign in to comment.