Clean up conditional compilation for clipboard support with sub features
This commit is contained in:
parent
9982049633
commit
d46a40c4a4
4 changed files with 60 additions and 225 deletions
|
@ -89,6 +89,12 @@ infer-command = []
|
||||||
# Compile without colored output support
|
# Compile without colored output support
|
||||||
no-color = ["colored/no-color"]
|
no-color = ["colored/no-color"]
|
||||||
|
|
||||||
|
# Automatic using build.rs: use xclip/xsel binary method for clipboard support
|
||||||
|
clipboard-bin = ["clipboard"]
|
||||||
|
|
||||||
|
# Automatic using build.rs: use native clipboard crate for clipboard support
|
||||||
|
clipboard-crate = ["clipboard"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
chbs = "0.0.8"
|
chbs = "0.0.8"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
|
@ -118,5 +124,5 @@ version-compare = "0.0.8"
|
||||||
which = { version = "2.0", optional = true }
|
which = { version = "2.0", optional = true }
|
||||||
|
|
||||||
[target.'cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd")))'.dependencies]
|
[target.'cfg(not(any(target_os = "linux", target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd", target_os = "netbsd")))'.dependencies]
|
||||||
# Package is aliased to clip to prevent name collision with clipboard feature
|
# Aliased to clip to prevent name collision with clipboard feature
|
||||||
clip = { version = "0.5", optional = true, package = "clipboard" }
|
clip = { version = "0.5", optional = true, package = "clipboard" }
|
||||||
|
|
22
build.rs
22
build.rs
|
@ -1,5 +1,4 @@
|
||||||
fn main() {
|
fn main() {
|
||||||
// xclip and xsel paths are inserted at compile time on Linux
|
|
||||||
#[cfg(all(
|
#[cfg(all(
|
||||||
feature = "clipboard",
|
feature = "clipboard",
|
||||||
any(
|
any(
|
||||||
|
@ -11,7 +10,28 @@ fn main() {
|
||||||
)
|
)
|
||||||
))]
|
))]
|
||||||
{
|
{
|
||||||
|
// Select clipboard binary method
|
||||||
|
#[cfg(not(feature = "clipboard-crate"))]
|
||||||
|
println!("cargo:rustc-cfg=feature=\"clipboard-bin\"");
|
||||||
|
|
||||||
|
// xclip and xsel paths are inserted at compile time
|
||||||
println!("cargo:rerun-if-env-changed=XCLIP_PATH");
|
println!("cargo:rerun-if-env-changed=XCLIP_PATH");
|
||||||
println!("cargo:rerun-if-env-changed=XSEL_PATH");
|
println!("cargo:rerun-if-env-changed=XSEL_PATH");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(all(
|
||||||
|
feature = "clipboard",
|
||||||
|
not(any(
|
||||||
|
target_os = "linux",
|
||||||
|
target_os = "freebsd",
|
||||||
|
target_os = "dragonfly",
|
||||||
|
target_os = "openbsd",
|
||||||
|
target_os = "netbsd",
|
||||||
|
))
|
||||||
|
))]
|
||||||
|
{
|
||||||
|
// Select clipboard crate method
|
||||||
|
#[cfg(not(feature = "clipboard-bin"))]
|
||||||
|
println!("cargo:rustc-cfg=feature=\"clipboard-crate\"");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,16 +6,7 @@ use prettytable::{format::FormatBuilder, Cell, Row, Table};
|
||||||
use crate::client::to_duration;
|
use crate::client::to_duration;
|
||||||
use crate::cmd::matcher::{debug::DebugMatcher, main::MainMatcher, Matcher};
|
use crate::cmd::matcher::{debug::DebugMatcher, main::MainMatcher, Matcher};
|
||||||
use crate::error::ActionError;
|
use crate::error::ActionError;
|
||||||
#[cfg(all(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
feature = "clipboard",
|
|
||||||
any(
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)
|
|
||||||
))]
|
|
||||||
use crate::util::ClipboardType;
|
use crate::util::ClipboardType;
|
||||||
use crate::util::{api_version_list, features_list, format_bool, format_duration};
|
use crate::util::{api_version_list, features_list, format_bool, format_duration};
|
||||||
|
|
||||||
|
@ -108,16 +99,7 @@ impl<'a> Debug<'a> {
|
||||||
]));
|
]));
|
||||||
|
|
||||||
// Clipboard information
|
// Clipboard information
|
||||||
#[cfg(all(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
feature = "clipboard",
|
|
||||||
any(
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)
|
|
||||||
))]
|
|
||||||
table.add_row(Row::new(vec![
|
table.add_row(Row::new(vec![
|
||||||
Cell::new("Clipboard:"),
|
Cell::new("Clipboard:"),
|
||||||
Cell::new(&format!("{}", ClipboardType::select())),
|
Cell::new(&format!("{}", ClipboardType::select())),
|
||||||
|
|
233
src/util.rs
233
src/util.rs
|
@ -1,28 +1,10 @@
|
||||||
#[cfg(all(
|
#[cfg(feature = "clipboard-crate")]
|
||||||
feature = "clipboard",
|
|
||||||
not(any(
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))
|
|
||||||
))]
|
|
||||||
extern crate clip;
|
extern crate clip;
|
||||||
extern crate colored;
|
extern crate colored;
|
||||||
extern crate directories;
|
extern crate directories;
|
||||||
extern crate fs2;
|
extern crate fs2;
|
||||||
extern crate open;
|
extern crate open;
|
||||||
#[cfg(all(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
feature = "clipboard",
|
|
||||||
any(
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)
|
|
||||||
))]
|
|
||||||
extern crate which;
|
extern crate which;
|
||||||
|
|
||||||
use std::borrow::Borrow;
|
use std::borrow::Borrow;
|
||||||
|
@ -31,43 +13,16 @@ use std::ffi::OsStr;
|
||||||
#[cfg(feature = "clipboard")]
|
#[cfg(feature = "clipboard")]
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::fmt::{Debug, Display};
|
use std::fmt::{Debug, Display};
|
||||||
#[cfg(all(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
feature = "clipboard",
|
|
||||||
any(
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)
|
|
||||||
))]
|
|
||||||
use std::io::ErrorKind as IoErrorKind;
|
use std::io::ErrorKind as IoErrorKind;
|
||||||
use std::io::{stderr, stdin, Error as IoError, Write};
|
use std::io::{stderr, stdin, Error as IoError, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::{exit, ExitStatus};
|
use std::process::{exit, ExitStatus};
|
||||||
#[cfg(all(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
feature = "clipboard",
|
|
||||||
any(
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)
|
|
||||||
))]
|
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(feature = "clipboard-crate")]
|
||||||
feature = "clipboard",
|
|
||||||
not(any(
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))
|
|
||||||
))]
|
|
||||||
use self::clip::{ClipboardContext, ClipboardProvider};
|
use self::clip::{ClipboardContext, ClipboardProvider};
|
||||||
use self::colored::*;
|
use self::colored::*;
|
||||||
#[cfg(feature = "history")]
|
#[cfg(feature = "history")]
|
||||||
|
@ -75,16 +30,7 @@ use self::directories::ProjectDirs;
|
||||||
use self::fs2::available_space;
|
use self::fs2::available_space;
|
||||||
use chrono::Duration;
|
use chrono::Duration;
|
||||||
use failure::{err_msg, Fail};
|
use failure::{err_msg, Fail};
|
||||||
#[cfg(all(
|
#[cfg(feature = "clipboard-crate")]
|
||||||
feature = "clipboard",
|
|
||||||
not(any(
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))
|
|
||||||
))]
|
|
||||||
use failure::{Compat, Error};
|
use failure::{Compat, Error};
|
||||||
use ffsend_api::{
|
use ffsend_api::{
|
||||||
api::request::{ensure_success, ResponseError},
|
api::request::{ensure_success, ResponseError},
|
||||||
|
@ -93,16 +39,7 @@ use ffsend_api::{
|
||||||
url::Url,
|
url::Url,
|
||||||
};
|
};
|
||||||
use rpassword::prompt_password_stderr;
|
use rpassword::prompt_password_stderr;
|
||||||
#[cfg(all(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
feature = "clipboard",
|
|
||||||
any(
|
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)
|
|
||||||
))]
|
|
||||||
use which::which;
|
use which::which;
|
||||||
|
|
||||||
use crate::cmd::matcher::MainMatcher;
|
use crate::cmd::matcher::MainMatcher;
|
||||||
|
@ -375,37 +312,19 @@ pub fn set_clipboard(content: String) -> Result<(), ClipboardError> {
|
||||||
#[derive(Clone, Eq, PartialEq)]
|
#[derive(Clone, Eq, PartialEq)]
|
||||||
pub enum ClipboardType {
|
pub enum ClipboardType {
|
||||||
/// Native operating system clipboard.
|
/// Native operating system clipboard.
|
||||||
#[cfg(not(any(
|
#[cfg(feature = "clipboard-crate")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)))]
|
|
||||||
Native,
|
Native,
|
||||||
|
|
||||||
/// Manage clipboard through `xclip` on Linux.
|
/// Manage clipboard through `xclip` on Linux.
|
||||||
///
|
///
|
||||||
/// May contain a binary path if specified at compile time through the `XCLIP_PATH` variable.
|
/// May contain a binary path if specified at compile time through the `XCLIP_PATH` variable.
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
Xclip(Option<String>),
|
Xclip(Option<String>),
|
||||||
|
|
||||||
/// Manage clipboard through `xsel` on Linux.
|
/// Manage clipboard through `xsel` on Linux.
|
||||||
///
|
///
|
||||||
/// May contain a binary path if specified at compile time through the `XSEL_PATH` variable.
|
/// May contain a binary path if specified at compile time through the `XSEL_PATH` variable.
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
Xsel(Option<String>),
|
Xsel(Option<String>),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,24 +332,12 @@ pub enum ClipboardType {
|
||||||
impl ClipboardType {
|
impl ClipboardType {
|
||||||
/// Select the clipboard type to use, depending on the runtime system.
|
/// Select the clipboard type to use, depending on the runtime system.
|
||||||
pub fn select() -> Self {
|
pub fn select() -> Self {
|
||||||
#[cfg(not(any(
|
#[cfg(feature = "clipboard-crate")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)))]
|
|
||||||
{
|
{
|
||||||
ClipboardType::Native
|
ClipboardType::Native
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
{
|
{
|
||||||
if let Some(path) = option_env!("XCLIP_PATH") {
|
if let Some(path) = option_env!("XCLIP_PATH") {
|
||||||
ClipboardType::Xclip(Some(path.to_owned()))
|
ClipboardType::Xclip(Some(path.to_owned()))
|
||||||
|
@ -450,29 +357,11 @@ impl ClipboardType {
|
||||||
/// Set clipboard contents through the selected clipboard type.
|
/// Set clipboard contents through the selected clipboard type.
|
||||||
pub fn set(&self, content: String) -> Result<(), ClipboardError> {
|
pub fn set(&self, content: String) -> Result<(), ClipboardError> {
|
||||||
match self {
|
match self {
|
||||||
#[cfg(not(any(
|
#[cfg(feature = "clipboard-crate")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)))]
|
|
||||||
ClipboardType::Native => Self::native_set(content),
|
ClipboardType::Native => Self::native_set(content),
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
ClipboardType::Xclip(path) => Self::xclip_set(path.clone(), content),
|
ClipboardType::Xclip(path) => Self::xclip_set(path.clone(), content),
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
ClipboardType::Xsel(path) => Self::xsel_set(path.clone(), content),
|
ClipboardType::Xsel(path) => Self::xsel_set(path.clone(), content),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -480,13 +369,7 @@ impl ClipboardType {
|
||||||
/// Set the clipboard through a native interface.
|
/// Set the clipboard through a native interface.
|
||||||
///
|
///
|
||||||
/// This is used on non-Linux systems.
|
/// This is used on non-Linux systems.
|
||||||
#[cfg(not(any(
|
#[cfg(feature = "clipboard-crate")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)))]
|
|
||||||
fn native_set(content: String) -> Result<(), ClipboardError> {
|
fn native_set(content: String) -> Result<(), ClipboardError> {
|
||||||
ClipboardProvider::new()
|
ClipboardProvider::new()
|
||||||
.and_then(|mut context: ClipboardContext| context.set_contents(content))
|
.and_then(|mut context: ClipboardContext| context.set_contents(content))
|
||||||
|
@ -494,13 +377,7 @@ impl ClipboardType {
|
||||||
.map_err(ClipboardError::Native)
|
.map_err(ClipboardError::Native)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
fn xclip_set(path: Option<String>, content: String) -> Result<(), ClipboardError> {
|
fn xclip_set(path: Option<String>, content: String) -> Result<(), ClipboardError> {
|
||||||
Self::sys_cmd_set(
|
Self::sys_cmd_set(
|
||||||
"xclip",
|
"xclip",
|
||||||
|
@ -511,13 +388,7 @@ impl ClipboardType {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
fn xsel_set(path: Option<String>, content: String) -> Result<(), ClipboardError> {
|
fn xsel_set(path: Option<String>, content: String) -> Result<(), ClipboardError> {
|
||||||
Self::sys_cmd_set(
|
Self::sys_cmd_set(
|
||||||
"xsel",
|
"xsel",
|
||||||
|
@ -526,13 +397,7 @@ impl ClipboardType {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
fn sys_cmd_set(
|
fn sys_cmd_set(
|
||||||
bin: &'static str,
|
bin: &'static str,
|
||||||
command: &mut Command,
|
command: &mut Command,
|
||||||
|
@ -576,32 +441,14 @@ impl ClipboardType {
|
||||||
impl fmt::Display for ClipboardType {
|
impl fmt::Display for ClipboardType {
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
match self {
|
match self {
|
||||||
#[cfg(not(any(
|
#[cfg(feature = "clipboard-crate")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)))]
|
|
||||||
ClipboardType::Native => write!(f, "native"),
|
ClipboardType::Native => write!(f, "native"),
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
ClipboardType::Xclip(path) => match path {
|
ClipboardType::Xclip(path) => match path {
|
||||||
None => write!(f, "xclip"),
|
None => write!(f, "xclip"),
|
||||||
Some(path) => write!(f, "xclip ({})", path),
|
Some(path) => write!(f, "xclip ({})", path),
|
||||||
},
|
},
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
ClipboardType::Xsel(path) => match path {
|
ClipboardType::Xsel(path) => match path {
|
||||||
None => write!(f, "xsel"),
|
None => write!(f, "xsel"),
|
||||||
Some(path) => write!(f, "xsel ({})", path),
|
Some(path) => write!(f, "xsel ({})", path),
|
||||||
|
@ -616,48 +463,24 @@ pub enum ClipboardError {
|
||||||
/// A generic error occurred while setting the clipboard contents.
|
/// A generic error occurred while setting the clipboard contents.
|
||||||
///
|
///
|
||||||
/// This is for non-Linux systems, using a native clipboard interface.
|
/// This is for non-Linux systems, using a native clipboard interface.
|
||||||
#[cfg(not(any(
|
#[cfg(feature = "clipboard-crate")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
)))]
|
|
||||||
#[fail(display = "failed to access clipboard")]
|
#[fail(display = "failed to access clipboard")]
|
||||||
Native(#[cause] Compat<Error>),
|
Native(#[cause] Compat<Error>),
|
||||||
|
|
||||||
/// The `xclip` or `xsel` binary could not be found on the system, required for clipboard support.
|
/// The `xclip` or `xsel` binary could not be found on the system, required for clipboard support.
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
#[fail(display = "failed to access clipboard, xclip or xsel is not installed")]
|
#[fail(display = "failed to access clipboard, xclip or xsel is not installed")]
|
||||||
NoBinary,
|
NoBinary,
|
||||||
|
|
||||||
/// An error occurred while using `xclip` or `xsel` to set the clipboard contents.
|
/// An error occurred while using `xclip` or `xsel` to set the clipboard contents.
|
||||||
/// This problem probably occurred when starting, or while piping the clipboard contents to
|
/// This problem probably occurred when starting, or while piping the clipboard contents to
|
||||||
/// the process.
|
/// the process.
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
#[fail(display = "failed to access clipboard using {}", _0)]
|
#[fail(display = "failed to access clipboard using {}", _0)]
|
||||||
BinaryIo(&'static str, #[cause] IoError),
|
BinaryIo(&'static str, #[cause] IoError),
|
||||||
|
|
||||||
/// `xclip` or `xsel` unexpectetly exited with a non-successful status code.
|
/// `xclip` or `xsel` unexpectetly exited with a non-successful status code.
|
||||||
#[cfg(any(
|
#[cfg(feature = "clipboard-bin")]
|
||||||
target_os = "linux",
|
|
||||||
target_os = "freebsd",
|
|
||||||
target_os = "dragonfly",
|
|
||||||
target_os = "openbsd",
|
|
||||||
target_os = "netbsd",
|
|
||||||
))]
|
|
||||||
#[fail(
|
#[fail(
|
||||||
display = "failed to use clipboard, {} exited with status code {}",
|
display = "failed to use clipboard, {} exited with status code {}",
|
||||||
_0, _1
|
_0, _1
|
||||||
|
@ -1150,6 +973,10 @@ pub fn features_list() -> Vec<&'static str> {
|
||||||
features.push("archive");
|
features.push("archive");
|
||||||
#[cfg(feature = "clipboard")]
|
#[cfg(feature = "clipboard")]
|
||||||
features.push("clipboard");
|
features.push("clipboard");
|
||||||
|
#[cfg(feature = "clipboard-bin")]
|
||||||
|
features.push("clipboard-bin");
|
||||||
|
#[cfg(feature = "clipboard-crate")]
|
||||||
|
features.push("clipboard-crate");
|
||||||
#[cfg(feature = "history")]
|
#[cfg(feature = "history")]
|
||||||
features.push("history");
|
features.push("history");
|
||||||
#[cfg(feature = "qrcode")]
|
#[cfg(feature = "qrcode")]
|
||||||
|
|
Loading…
Reference in a new issue