Skip to content

Commit

Permalink
👔 up(sys/clip): add new util func clipboard.Std()
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere committed Mar 6, 2023
1 parent 77bac4b commit 9f81953
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions sysutil/clipboard/util.go
Expand Up @@ -48,6 +48,11 @@ var (
// std instance
var std = New()

// Std get
func Std() *Clipboard {
return std
}

// Reset clipboard data
func Reset() error {
return std.Reset()
Expand Down
3 changes: 2 additions & 1 deletion sysutil/clipboard/util_test.go
Expand Up @@ -10,11 +10,12 @@ import (
func TestGetReaderBin(t *testing.T) {
assert.NotEmpty(t, clipboard.GetReaderBin())
assert.NotEmpty(t, clipboard.GetWriterBin())
assert.NotEmpty(t, clipboard.Std())
}

func TestClipboard_read_write(t *testing.T) {
err := clipboard.WriteString("")
assert.ErrMsg(t, err, "not write contents")
assert.ErrMsg(t, err, "clipboard: empty contents for write")

if !clipboard.Available() {
assert.False(t, clipboard.Available())
Expand Down

0 comments on commit 9f81953

Please sign in to comment.