-
Notifications
You must be signed in to change notification settings - Fork 21
server: use a command line parser #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
server: use a command line parser #33
Conversation
45a6504 to
6c47ec0
Compare
|
I do not know if you want to keep the configuration a positional argument or it is fine introduce a |
6c47ec0 to
9a240f8
Compare
|
Currently we avoid clap dependency in server since we need a single argument. |
Oh I see make a lot of sense, so I will update the PR in according with this! sorry for the miss understanding! |
9a240f8 to
57959aa
Compare
|
Ok sorry for the delay here. I modified the code and just make a small match on the P.S: I rebase the PR on top of the @dzdidi PR! |
57959aa to
5b2723a
Compare
5b2723a to
183cd57
Compare
|
While reading your suggestion on some review @G8XSU I wrote another commit to check if the config file is a file f3cee47 let me know if you prefer this solution and remove the --help, or if you want to keep both. Anything is fine for me, I preferer keep |
f3cee47 to
6feb755
Compare
This commit is including a simple check and suggest a help string
for the user when the command `--help` is used. Without this diff
applied the server will panic and the user will not have any clue
why.
Running `target/debug/ldk-server --help`
thread 'main' panicked at ldk-server/src/main.rs:30:56:
Invalid configuration file.: Custom { kind: NotFound, error: "Failed to read config file '--help': No such file or directory (os error 2)" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1] 750067 IOT instruction (core dumped) cargo run --bin ldk-server -- --help
Signed-off-by: Vincenzo Palazzo <[email protected]>
Signed-off-by: Vincenzo Palazzo <[email protected]>
6feb755 to
e26e467
Compare
|
Lgtm! Thanks ! |
This commit adds a command line parser to the server. The parser is useful to avoid crashing when trying to run a simple --help command and also in the future when we will add more configuration options.
It will be really cool if the config file is optional and the user can configure the server using the command line by appending all the options to
ldk-server --option1 value1 --option2 value2.