Skip to content

Commit

Permalink
Added clipboard funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
gentee committed Jan 22, 2021
1 parent 9e681bb commit 3ba2fe9
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 23 deletions.
80 changes: 57 additions & 23 deletions assets.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
github.com/alecthomas/chroma v0.8.2
github.com/alecthomas/colour v0.1.0 // indirect
github.com/alecthomas/repr v0.0.0-20201120212035-bb82daffcca2 // indirect
github.com/atotto/clipboard v0.1.2
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/dlclark/regexp2 v1.4.0 // indirect
github.com/gentee/gentee v1.20.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkx
github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ=
github.com/alecthomas/repr v0.0.0-20201120212035-bb82daffcca2 h1:G5TeG64Ox4OWq2YwlsxS7nOedU8vbGgNRTRDAjGvDCk=
github.com/alecthomas/repr v0.0.0-20201120212035-bb82daffcca2/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=
github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY=
github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/daaku/go.zipexe v1.0.0/go.mod h1:z8IiR6TsVLEYKwXAoE/I+8ys/sDkgTzSL0CLnGVd57E=
github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ=
Expand Down
11 changes: 11 additions & 0 deletions script/embedded.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"sync"
"time"

"github.com/atotto/clipboard"
"github.com/gentee/gentee"
"github.com/gentee/gentee/vm"
"github.com/kataras/golog"
Expand Down Expand Up @@ -129,8 +130,10 @@ var (
{Prototype: `deinit()`, Object: Deinit},
{Prototype: `Condition(map.obj) bool`, Object: MapCondition},
{Prototype: `Condition(str,str) bool`, Object: Condition},
{Prototype: `CopyClipboard(str)`, Object: CopyClipboard},
{Prototype: `File(str) str`, Object: FileLoad},
{Prototype: `Form(str)`, Object: Form},
{Prototype: `GetClipboard() str`, Object: GetClipboard},
{Prototype: `IsEntry() bool`, Object: IsEntry},
{Prototype: `IsVarObj(str) bool`, Object: IsVarObj},
{Prototype: `IsVar(str) bool`, Object: IsVar},
Expand Down Expand Up @@ -685,3 +688,11 @@ func SendNotification(msg string) error {
}
return nil
}

func CopyClipboard(data string) error {
return clipboard.WriteAll(data)
}

func GetClipboard() (string, error) {
return clipboard.ReadAll()
}

0 comments on commit 3ba2fe9

Please sign in to comment.