Start implementing a verbose mode

This commit is contained in:
timvisee 2018-05-17 18:24:34 +02:00
parent b54851a37a
commit f2771f7953
No known key found for this signature in database
GPG key ID: 109CBA0BF74036C2
4 changed files with 18 additions and 5 deletions

View file

@ -20,4 +20,4 @@ toolchain.
- `FFSEND_OPEN`: open an uploaded file (present/boolean)
- `FFSEND_ARCHIVE`: enable file archival (present/boolean)
- `FFSEND_COPY`: copy share URL to clipboard (present/boolean)
- `FFSEND_VERBOSE`: copy share URL to clipboard (present/boolean)

View file

@ -222,10 +222,12 @@ impl<'a> Upload<'a> {
Cell::new("Share URL:"),
Cell::new(url.as_str()),
]));
table.add_row(Row::new(vec![
Cell::new("Owner token:"),
Cell::new(file.owner_token().unwrap()),
]));
if matcher_main.verbose() {
table.add_row(Row::new(vec![
Cell::new("Owner token:"),
Cell::new(file.owner_token().unwrap()),
]));
}
table.printstd();
// Add the file to the history manager

View file

@ -75,6 +75,12 @@ impl<'a: 'b, 'b> Handler<'a> {
.alias("assume-yes")
.global(true)
.help("Assume yes for prompts"))
.arg(Arg::with_name("verbose")
.long("verbose")
.short("v")
.multiple(true)
.global(true)
.help("Enable verbose information and logging"))
.subcommand(CmdDebug::build())
.subcommand(CmdDelete::build())
.subcommand(CmdDownload::build().display_order(2))

View file

@ -54,6 +54,11 @@ impl<'a: 'b, 'b> MainMatcher<'a> {
pub fn incognito(&self) -> bool {
self.matches.is_present("incognito") || env_var_present("FFSEND_INCOGNITO")
}
/// Check whether verbose mode is used.
pub fn verbose(&self) -> bool {
self.matches.is_present("verbose") || env_var_present("FFSEND_VERBOSE")
}
}
impl<'a> Matcher<'a> for MainMatcher<'a> {