-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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`. 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]>
- Loading branch information
1 parent
31026d6
commit 45a6504
Showing
4 changed files
with
20 additions
and
7 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
use clap::Parser; | ||
|
||
#[derive(Parser, Debug)] | ||
pub struct Cli { | ||
#[arg(short, long)] | ||
pub config: Option<String>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters