File tree 1 file changed +13
-1
lines changed
1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change 1
1
package commands
2
2
3
3
import (
4
+ "errors"
4
5
"flag"
5
6
"fmt"
7
+ "strings"
6
8
"uosc/bins/src/ziggy/lib"
7
9
8
10
"github.com/atotto/clipboard"
@@ -13,8 +15,18 @@ type ClipboardResult struct {
13
15
}
14
16
15
17
func GetClipboard (_ []string ) {
18
+ // We need to do this instead of just `Payload: lib.Must(clipboard.ReadAll())` because
19
+ // the atotto/clipboard returns unhelpful messages like "the operation completed successfully".
20
+ payload , err := clipboard .ReadAll ()
21
+ if err != nil {
22
+ if strings .Contains (strings .ToLower (err .Error ()), "successfully" ) {
23
+ lib .Check (errors .New ("clipboard format not supported" ))
24
+ }
25
+ lib .Check (err )
26
+ }
27
+
16
28
fmt .Print (string (lib .Must (lib .JSONMarshal (ClipboardResult {
17
- Payload : lib . Must ( clipboard . ReadAll ()) ,
29
+ Payload : payload ,
18
30
}))))
19
31
}
20
32
You can’t perform that action at this time.
0 commit comments