1
1
use clap:: { App , Arg } ;
2
+ use clipboard:: { ClipboardContext , ClipboardProvider } ;
2
3
use rand:: seq:: SliceRandom ;
3
4
use regex:: Regex ;
4
5
use rodio:: { OutputStream , Sink , Source } ;
5
6
use std:: collections:: HashMap ;
6
7
use std:: env;
7
- use clipboard:: { ClipboardContext , ClipboardProvider } ;
8
8
use std:: fs:: { self , File } ;
9
9
use std:: io:: { self , Error , Read , Write } ;
10
10
use std:: path:: Path ;
@@ -17,7 +17,7 @@ mod test;
17
17
18
18
fn main ( ) {
19
19
let matches = App :: new ( "Stack" )
20
- . version ( "1.11 " )
20
+ . version ( "1.12 " )
21
21
. author ( "Stack Programming Community" )
22
22
. about ( "The powerful script language designed with a stack oriented approach for efficient execution. " )
23
23
. arg ( Arg :: new ( "script" )
@@ -1406,14 +1406,14 @@ impl Executor {
1406
1406
ctx = i
1407
1407
} else {
1408
1408
self . stack . push ( Type :: Error ( "set-clipboard" . to_string ( ) ) ) ;
1409
- return
1409
+ return ;
1410
1410
} ;
1411
-
1411
+
1412
1412
let value = self . pop_stack ( ) . get_string ( ) ;
1413
1413
if ctx. set_contents ( value. clone ( ) ) . is_ok ( ) {
1414
1414
self . stack . push ( Type :: String ( value) ) ;
1415
1415
} else {
1416
- self . stack . push ( Type :: Error ( "get -clipboard" . to_string ( ) ) )
1416
+ self . stack . push ( Type :: Error ( "set -clipboard" . to_string ( ) ) )
1417
1417
} ;
1418
1418
}
1419
1419
@@ -1423,11 +1423,10 @@ impl Executor {
1423
1423
if let Ok ( i) = ClipboardProvider :: new ( ) {
1424
1424
ctx = i
1425
1425
} else {
1426
- self . stack . push ( Type :: Error ( "set -clipboard" . to_string ( ) ) ) ;
1427
- return
1426
+ self . stack . push ( Type :: Error ( "get -clipboard" . to_string ( ) ) ) ;
1427
+ return ;
1428
1428
} ;
1429
1429
1430
-
1431
1430
if let Ok ( contents) = ctx. get_contents ( ) {
1432
1431
self . stack . push ( Type :: String ( contents) ) ;
1433
1432
} else {
0 commit comments