Documentation ¶
Overview ¶
Package clipboard provide a simple clipboard read and write operations.
Index ¶
- Constants
- func Available() bool
- func GetReaderBin() string
- func GetWriterBin() string
- func ReadString() (string, error)
- func Reset() error
- func WriteString(s string) error
- type Clipboard
- func (c *Clipboard) Available() bool
- func (c *Clipboard) Clean() error
- func (c *Clipboard) Flush() error
- func (c *Clipboard) Read() ([]byte, error)
- func (c *Clipboard) ReadString() (string, error)
- func (c *Clipboard) ReadTo(w io.Writer) error
- func (c *Clipboard) ReadToBuffer() (*bytes.Buffer, error)
- func (c *Clipboard) ReadToFile(filepath string) error
- func (c *Clipboard) Readable() bool
- func (c *Clipboard) Reset() error
- func (c *Clipboard) SafeString() string
- func (c *Clipboard) WithVerbose(yn bool) *Clipboard
- func (c *Clipboard) Write(p []byte) (int, error)
- func (c *Clipboard) WriteFrom(r io.Reader) error
- func (c *Clipboard) WriteFromFile(filepath string) error
- func (c *Clipboard) WriteString(s string) (int, error)
- func (c *Clipboard) Writeable() bool
Constants ¶
View Source
const ( // WriterOnMac driver // // Example: // echo hello | pbcopy // pbcopy < tempfile.txt WriterOnMac = "pbcopy" // WriterOnWin driver on Windows // // TIP: clip only support write contents to clipboard. WriterOnWin = "clip" // WriterOnLin driver name // // linux: // echo "hello-c" | xclip -selection c WriterOnLin = "xclip -selection clipboard" // ReaderOnMac driver // // Example: // Mac: pbpaste >> tasklist.txt ReaderOnMac = "pbpaste" // ReaderOnWin driver on Windows // // read clipboard should use: powershell get-clipboard ReaderOnWin = "powershell get-clipboard" // ReaderOnLin driver name // // Usage: // xclip -o -selection clipboard // xclip -o -selection c // can use shorts ReaderOnLin = "xclip -o -selection clipboard" )
clipboard writer, reader program names
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Clipboard ¶
type Clipboard struct {
// contains filtered or unexported fields
}
Clipboard struct
func (*Clipboard) ReadString ¶
ReadString contents as string from clipboard
func (*Clipboard) ReadToBuffer ¶ added in v0.6.7
ReadToBuffer read clipboard contents to new buffer.
func (*Clipboard) ReadToFile ¶
ReadToFile dump clipboard data to file
func (*Clipboard) SafeString ¶ added in v0.6.13
SafeString read contents as string from clipboard, will return empty string on error
func (*Clipboard) WithVerbose ¶ added in v0.6.7
WithVerbose setting
func (*Clipboard) WriteFromFile ¶
WriteFromFile contents to clipboard
func (*Clipboard) WriteString ¶
WriteString data to buffer. should call Flush() to write to clipboard
Click to show internal directories.
Click to hide internal directories.