clap-rs / clap-port-flag

Easily add address & port flags to CLIs using Clap
Apache License 2.0
15 stars 2 forks source link

Consider --bind rather than --port/--address #16

Open Nemo157 opened 6 years ago

Nemo157 commented 6 years ago

I realise I'm going against a lot of prior server CLI design, but I much prefer a more descriptive command line argument than the normal --port argument. A design that I've used in the past is

BIND_ADDRESS=127.0.0.1:5476
--bind 127.0.0.1:5476

which can reuse SocketAddr::from_str for parsing.

spacekookie commented 6 years ago

We could just add --bind so that people can choose...

yoshuawuyts commented 6 years ago

@spacekookie I don't like the idea of duplicating functionality in what's considered a limited space (e.g. there's a thing like too many flags). Instead I think it might be better to create a separate module called clap-bind-flag, which exposes similar-but-different functionality than clap-port-flag.

Nemo157 commented 6 years ago

@yoshuawuyts TBH that's how I was reading @spacekookie's suggestion (although I was thinking in the same crate). That way it's up to the developer of the service to choose how they want to present it to their users.

spacekookie commented 6 years ago

I originally had a feature flag in mind, but creating a clap-bind-flag crate that uses common functionality from this crate is probably better.