|
@@ -19,15 +19,15 @@ use super::select_api_version;
|
|
|
#[cfg(feature = "archive")]
|
|
|
use crate::archive::archiver::Archiver;
|
|
|
use crate::client::create_transfer_client;
|
|
|
-use crate::cmd::matcher::{MainMatcher, Matcher, UploadMatcher};
|
|
|
+use crate::cmd::matcher::{CopyMode, MainMatcher, Matcher, UploadMatcher};
|
|
|
#[cfg(feature = "history")]
|
|
|
use crate::history_tool;
|
|
|
use crate::progress::ProgressBar;
|
|
|
#[cfg(feature = "clipboard")]
|
|
|
use crate::util::set_clipboard;
|
|
|
use crate::util::{
|
|
|
- format_bytes, open_url, print_error, print_error_msg, prompt_yes, quit, quit_error_msg,
|
|
|
- ErrorHintsBuilder,
|
|
|
+ bin_name, format_bytes, open_url, print_error, print_error_msg, prompt_yes, quit,
|
|
|
+ quit_error_msg, ErrorHintsBuilder,
|
|
|
};
|
|
|
|
|
|
/// A file upload action.
|
|
@@ -268,8 +268,15 @@ impl<'a> Upload<'a> {
|
|
|
// Copy the URL in the user's clipboard
|
|
|
#[cfg(feature = "clipboard")]
|
|
|
{
|
|
|
- if matcher_upload.copy() {
|
|
|
- if let Err(err) = set_clipboard(url.as_str().to_owned()) {
|
|
|
+ if let Some(copy_mode) = matcher_upload.copy() {
|
|
|
+ // Build the string to copy
|
|
|
+ let copy = match copy_mode {
|
|
|
+ CopyMode::Url => url.as_str().to_owned(),
|
|
|
+ CopyMode::DownloadCmd => format!("{} download {}", bin_name(), url.as_str()),
|
|
|
+ };
|
|
|
+
|
|
|
+ // Copy to clipboard
|
|
|
+ if let Err(err) = set_clipboard(copy) {
|
|
|
print_error(
|
|
|
err.context("failed to copy the share link to the clipboard, ignoring"),
|
|
|
);
|