clipboard

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package clipboard writes to the system clipboard via whatever tool the platform has, with no third-party dependency.

Go port of Ruby's lib/tui/clipboard.rb.

Index

Constants

This section is empty.

Variables

View Source
var Commands = [][]string{
	{"pbcopy"},
	{"wl-copy"},
	{"xclip", "-selection", "clipboard"},
	{"xsel", "--clipboard", "--input"},
}

Commands are tried in order; the first one on PATH wins.

Functions

func Command

func Command() []string

Command returns the clipboard command available on this machine, or nil. The lookup is performed once per process, as in Ruby.

func Copy

func Copy(text string, cmd []string) bool

Copy writes text to the clipboard and reports success. cmd is injectable for tests; a nil cmd uses the detected command, and no command at all is a non-fatal false.

Types

This section is empty.

Jump to

Keyboard shortcuts

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