clipboard

package module
v1.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2022 License: BSD-3-Clause Imports: 3 Imported by: 18

README

This is a fork of atotto/clipboard

This fork is used for zyedidia/micro and has some modifications, namely: support for the primary clipboard on linux and support for an internal clipboard if the system clipboard is not available.

Build Status

GoDoc

Clipboard for Go

Provide copying and pasting to the Clipboard for Go.

Build:

$ go get github.com/atotto/clipboard

Platforms:

  • OSX
  • Windows 7 (probably work on other Windows)
  • Linux, Unix (requires 'xclip' or 'xsel' command to be installed)

Document:

Notes:

  • Text string only
  • UTF-8 text encoding only (no conversion)

TODO:

  • Clipboard watcher(?)

Commands:

paste shell command:

$ go get github.com/atotto/clipboard/cmd/gopaste
$ # example:
$ gopaste > document.txt

copy shell command:

$ go get github.com/atotto/clipboard/cmd/gocopy
$ # example:
$ cat document.txt | gocopy

Documentation

Overview

Package clipboard read/write on clipboard

Example
package main

import (
	"fmt"

	"github.com/zyedidia/clipboard"
)

func main() {
	clipboard.WriteAll("日本語", "clipboard")
	text, _ := clipboard.ReadAll("clipboard")
	fmt.Println(text)

}
Output:

日本語

Index

Examples

Constants

This section is empty.

Variables

View Source
var Unsupported bool

Unsupported might be set true during clipboard init, to help callers decide whether or not to offer clipboard options.

Functions

func Initialize added in v1.0.2

func Initialize() error

Initialize attempts to initialize the clipboard This function can only return an error on Linux

func ReadAll

func ReadAll(register string) (string, error)

ReadAll read string from clipboard

func WriteAll

func WriteAll(text, register string) error

WriteAll write string to clipboard

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL