| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
package clipboard |
| 7 |
|
| 8 |
import "context" |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
var ForceUnsupported bool |
| 13 |
|
| 14 |
|
| 15 |
func ReadAll(ctx context.Context) ([]byte, error) { |
| 16 |
return readAll(ctx) |
| 17 |
} |
| 18 |
|
| 19 |
|
| 20 |
func ReadAllString(ctx context.Context) (string, error) { |
| 21 |
text, err := readAll(ctx) |
| 22 |
if err != nil { |
| 23 |
return "", err |
| 24 |
} |
| 25 |
|
| 26 |
return string(text), nil |
| 27 |
} |
| 28 |
|
| 29 |
|
| 30 |
func WriteAll(ctx context.Context, text []byte) error { |
| 31 |
return writeAll(ctx, text, false) |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
func WriteAllString(ctx context.Context, text string) error { |
| 36 |
return writeAll(ctx, []byte(text), false) |
| 37 |
} |
| 38 |
|
| 39 |
|
| 40 |
func WritePassword(ctx context.Context, text []byte) error { |
| 41 |
return writeAll(ctx, text, true) |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
func IsUnsupported() bool { |
| 46 |
return unsupported() || ForceUnsupported |
| 47 |
} |