From 9cd1f777171ab5474c0b44bf73f18a85f04cbbc2 Mon Sep 17 00:00:00 2001 From: Wesley Gahr Date: Sun, 2 Jun 2019 21:51:56 +0200 Subject: [PATCH] Only output link to stdout when calling upload (without other text) --- src/action/upload.rs | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/src/action/upload.rs b/src/action/upload.rs index dc54095..6837b60 100644 --- a/src/action/upload.rs +++ b/src/action/upload.rs @@ -292,27 +292,35 @@ impl<'a> Upload<'a> { } } - // Show the share URL - table.add_row(Row::new(vec![ - Cell::new("Share link:"), - Cell::new(url.as_str()), - ])); - - // Show a generate passphrase - if password_generated { - table.add_row(Row::new(vec![ - Cell::new("Passphrase:"), - Cell::new(&password.unwrap_or("?".into())), - ])); - } - - // Show the owner token if matcher_main.verbose() { + // Show the share URL + table.add_row(Row::new(vec![ + Cell::new("Share link:"), + Cell::new(url.as_str()), + ])); + + // Show a generate passphrase + if password_generated { + table.add_row(Row::new(vec![ + Cell::new("Passphrase:"), + Cell::new(&password.unwrap_or("?".into())), + ])); + } + + // Show the owner token table.add_row(Row::new(vec![ Cell::new("Owner token:"), Cell::new(file.owner_token().unwrap()), ])); + } else { + table.add_row(Row::new(vec![Cell::new(url.as_str())])); + + // Show a generate passphrase + if password_generated { + table.add_row(Row::new(vec![Cell::new(&password.unwrap_or("?".into()))])); + } } + table.printstd(); } else { println!("{}", url);