Skip to content

Commit fc2c83b

Browse files
authored
Add demo flag documentation in error message (#162)
This changes add information about `--demo` flag on clap parse error if the required argument is not supplied. Close #160
1 parent 580ba9a commit fc2c83b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

server/src/option.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,14 @@ where
5353
S: Clone + clap::Args + StorageOpt,
5454
{
5555
fn new() -> Self {
56-
Config {
57-
parseable: Opt::<S>::parse(),
58-
}
56+
let parseable = match Opt::<S>::try_parse() {
57+
Ok(s) => s,
58+
Err(e) => {
59+
eprintln!("You can also use the --demo flag to run Parseable with default object storage. For testing purposes only");
60+
e.exit();
61+
}
62+
};
63+
Config { parseable }
5964
}
6065

6166
pub fn storage(&self) -> &S {

0 commit comments

Comments
 (0)