clap-port-flag
Easily add a --port
flag to CLIs using clap.
Usage
Example: Base
With the following code in src/main.rs
:
use Parser;
use Port;
When you run the binary, it'll provide the following output:
my-cool-app 0.2.0
Alice Person <alice@person.com>
Application that does things over TCP.
USAGE:
main [OPTIONS]
FLAGS:
-h, --help Prints help information
-V, --version Prints version information
OPTIONS:
--listen-fd <fd> A previously opened network socket. [env: LISTEN_FD=]
-a, --address <hostname> The network address to listen to. [default: 127.0.0.1]
-p, --port <port> The network port to listen to. [env: PORT=]
Example: Hyper
use Port;
use *;
use service_fn;
use ;
use Parser;
async
async
Installation
Further Reading
Acknowledgements
The original version of this crate was sketched out by @TeXitoi in rust-lang-nursery/cli-wg#37.
License
MIT OR Apache-2.0