Comments (3)
Upon seening
$ LANG=C sudo target/debug/erbium --help
[2021-01-02T21:31:06Z INFO erbium] erbium 0.2.6 (e2d2af8)
[2021-01-02T21:31:06Z ERROR erbium] Error: Failed to load config from --help: No such file or directory (os error 2)
makes me think the original reported issue has been improved.
But an usage message isn't yet presented to user.
--- a/src/main.rs
+++ b/src/main.rs
@@ -63,6 +63,11 @@ async fn go() -> Result<(), Error> {
} else {
std::path::Path::new(&args[1])
};
+ if config_file.starts_with("-") {
+ /* User is trying `-h`, `--help` or another option we don't support */
+ error!("Usage: {} <configfile>", args[0].to_string_lossy());
+ return Ok(());
+ }
let conf = erbium::config::load_config_from_path(config_file)
.await
.map_err(|e| Error::ConfigError(config_file.to_path_buf(), e))?;
is something that compiles but never reaches true.
https://doc.rust-lang.org/std/path/struct.Path.html#method.starts_with says
Only considers whole path components to match.
And whole path starts with /
...
In other words: The reported issue got some attention, but still no information printed about flags.
from erbium.
I've not really come to a conclusion about how I want to handle command line arguments just yet, but you're right, this is a pretty nasty quality of life issue, so I've bodged in a solution similar to what you proposed.
I'm going to leave this issue open until I figure out how I want to handle parsing command line arguments properly. Do you think this is sufficient, or have I missed any other obvious cases?
from erbium.
Do you think this is sufficient
Yes.
And I suggest to close this issue.
from erbium.
Related Issues (20)
- doesn't say where it's attempting to read configuration from when it fails
- exits with exit code 0 when configuration can't be parsed
- doesn't handle IPv6 domain name servers - Add support for RDNSS HOT 3
- Request: Publish as crate HOT 2
- Error: I/O Error in DHCP: Address already in use (os error 98) HOT 6
- Example configuration file HOT 1
- Build failed on nixos... HOT 6
- add lldp support
- dhcp should populate the arp table
- dhcp should support dhcp relay
- dhcp should support rfc8925 (ipv6-only prefered)
- add ntp support
- add mDNS support
- dns ratelimiter needs tuning.
- dns should support dnssec
- experiment with multiarmed bandits for choosing which dns server to forward to.
- Add goals / requirements document
- Support RFC8914 (extended DNS errors) HOT 1
- 100% CPU usage just after starting erbium HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from erbium.