mirror of
https://github.com/atuinsh/atuin.git
synced 2025-02-03 20:19:55 +01:00
chore: make clipboard dep optional as a feature (#1558)
The cli-clipboard doesn't compile on systems other than Windows, Linux and MacOS, e.g. on Android it fails to compile.
This commit is contained in:
parent
5d55195e17
commit
7629bb4701
@ -33,10 +33,11 @@ buildflags = ["--release"]
|
|||||||
atuin = { path = "/usr/bin/atuin" }
|
atuin = { path = "/usr/bin/atuin" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["client", "sync", "server"]
|
default = ["client", "sync", "server", "clipboard"]
|
||||||
client = ["atuin-client"]
|
client = ["atuin-client"]
|
||||||
sync = ["atuin-client/sync"]
|
sync = ["atuin-client/sync"]
|
||||||
server = ["atuin-server", "atuin-server-postgres", "tracing-subscriber"]
|
server = ["atuin-server", "atuin-server-postgres", "tracing-subscriber"]
|
||||||
|
clipboard = ["cli-clipboard"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
atuin-server-postgres = { path = "../atuin-server-postgres", version = "17.2.1", optional = true }
|
atuin-server-postgres = { path = "../atuin-server-postgres", version = "17.2.1", optional = true }
|
||||||
@ -73,7 +74,7 @@ fuzzy-matcher = "0.3.7"
|
|||||||
colored = "2.0.4"
|
colored = "2.0.4"
|
||||||
ratatui = "0.25"
|
ratatui = "0.25"
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
cli-clipboard = "0.4.0"
|
cli-clipboard = { version = "0.4.0", optional = true }
|
||||||
|
|
||||||
|
|
||||||
[dependencies.tracing-subscriber]
|
[dependencies.tracing-subscriber]
|
||||||
|
@ -940,7 +940,7 @@ pub async fn history(
|
|||||||
InputAction::ReturnOriginal => Ok(String::new()),
|
InputAction::ReturnOriginal => Ok(String::new()),
|
||||||
InputAction::Copy(index) => {
|
InputAction::Copy(index) => {
|
||||||
let cmd = results.swap_remove(index).command;
|
let cmd = results.swap_remove(index).command;
|
||||||
cli_clipboard::set_contents(cmd).unwrap();
|
set_clipboard(cmd);
|
||||||
Ok(String::new())
|
Ok(String::new())
|
||||||
}
|
}
|
||||||
InputAction::ReturnQuery | InputAction::Accept(_) => {
|
InputAction::ReturnQuery | InputAction::Accept(_) => {
|
||||||
@ -954,3 +954,11 @@ pub async fn history(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "clipboard")]
|
||||||
|
fn set_clipboard(s: String) {
|
||||||
|
cli_clipboard::set_contents(s).unwrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "clipboard"))]
|
||||||
|
fn set_clipboard(_s: String) {}
|
||||||
|
Loading…
Reference in New Issue
Block a user