Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
github.com/hulloitskai/glip
A clipboard interface for Go, compatible with Windows, Mac OS X, and Linux.
Install glip
like you would any other Go package:
go get github.com/stevenxie/glip
Since a glip.Board
(a clipboard interface) includes io.Writer
, io.Reader
,
io.WriterTo
, and io.ReaderFrom
, it can be used just about anywhere:
import (
"fmt"
"github.com/stevenxie/glip"
)
func main() {
// Save "snip snip" into the system clipboard.
glip.WriteString("snip snip")
// And we're done!
// Read clipboard contents into a string (ignoring the error).
out, _ := glip.ReadString()
fmt.Println(out)
// Output: snip snip
}
glip
provides API-wrapping structs specific to each clipboard-accessing
program; each struct implements the Board
interface.
If you know which specific program you would like to use, you can create a new
instance of the associated wrapper struct (i.e. PShellBoard
, Clip
,
DarwinBoard
, Xclip
, or Xsel
), and set program-specific flags / options
using the wrapper struct.
glip
uses the the PowerShell Get-Clipboard
and Set-Clipboard
cmdlets to
read and write to the Windows clipboard.
If PowerShell is not available, the clip
command is used to write to the
Windows clipboard.
glip
uses pbcopy
and pbpaste
commands on macOS.
glip
requires the installation of either xclip
or xsel
to function on
Linux (since there's no built-in clipboard interface). glip
will choose
whichever program is available, with a preference for xsel
if both are
avaiklable.
glip
sometimes seems to fail arbitrarily on x86 Windows, and I'm not sure why.
It seems like the PowerShell clipboard modules are not very reliable?
If anybody can accurately diagnose the situation on a Windows machine, I'd be very grateful 🙂.
For an example of an application that uses glip
, check out glipboard
(located at /cmd/glipboard/
).
glipboard
was developed to both showcase how glip
can be used in a real
application, as well as to be a universal clipboard interface that external
programs can call in order to write to a system clipboard, if the underlying
commands are available.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.