@@ -10,12 +10,13 @@ use std::{
10
10
} ;
11
11
12
12
use anyhow:: Context ;
13
+ #[ cfg( feature = "clipboard" ) ]
13
14
use arboard:: Clipboard ;
14
15
use clap:: {
15
16
error:: { ContextKind , ErrorKind } ,
16
17
CommandFactory , Parser , Subcommand ,
17
18
} ;
18
- use console:: { style, Key , Term } ;
19
+ use console:: style;
19
20
use data_encoding:: HEXLOWER ;
20
21
use futures_buffered:: BufferedStreamExt ;
21
22
use indicatif:: {
@@ -216,6 +217,7 @@ pub struct SendArgs {
216
217
pub common : CommonArgs ,
217
218
218
219
/// Store the receive command in the clipboard.
220
+ #[ cfg( feature = "clipboard" ) ]
219
221
#[ clap( short = 'c' , long) ]
220
222
pub clipboard : bool ,
221
223
}
@@ -741,20 +743,25 @@ async fn send(args: SendArgs) -> anyhow::Result<()> {
741
743
println ! ( "to get this data, use" ) ;
742
744
println ! ( "sendme receive {ticket}" ) ;
743
745
744
- // Add command to the clipboard
745
- if args. clipboard {
746
- add_to_clipboard ( & ticket) ;
747
- }
746
+ #[ cfg( feature = "clipboard" ) ]
747
+ {
748
+ use console:: { Key , Term } ;
748
749
749
- let _keyboard = tokio:: task:: spawn ( async move {
750
- let term = Term :: stdout ( ) ;
751
- println ! ( "press c to copy command to clipboard, or use the --clipboard argument" ) ;
752
- loop {
753
- if let Ok ( Key :: Char ( 'c' ) ) = term. read_key ( ) {
754
- add_to_clipboard ( & ticket) ;
755
- }
750
+ // Add command to the clipboard
751
+ if args. clipboard {
752
+ add_to_clipboard ( & ticket) ;
756
753
}
757
- } ) ;
754
+
755
+ let _keyboard = tokio:: task:: spawn ( async move {
756
+ let term = Term :: stdout ( ) ;
757
+ println ! ( "press c to copy command to clipboard, or use the --clipboard argument" ) ;
758
+ loop {
759
+ if let Ok ( Key :: Char ( 'c' ) ) = term. read_key ( ) {
760
+ add_to_clipboard ( & ticket) ;
761
+ }
762
+ }
763
+ } ) ;
764
+ }
758
765
759
766
tokio:: signal:: ctrl_c ( ) . await ?;
760
767
@@ -771,6 +778,7 @@ async fn send(args: SendArgs) -> anyhow::Result<()> {
771
778
Ok ( ( ) )
772
779
}
773
780
781
+ #[ cfg( feature = "clipboard" ) ]
774
782
fn add_to_clipboard ( ticket : & BlobTicket ) {
775
783
let clipboard = Clipboard :: new ( ) ;
776
784
match clipboard {
0 commit comments