bore

package module
v2.0.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 19 Imported by: 0

README

Bore

[!WARNING] This project is still under development, use at your own risk, this is mostly functional enough for my use at work currently.

A clipboard implementation for headless (and non-headless) environments

Install

You can download binaries for your platform from the releases page or install directly with the Go toolchain:

go install go.trulyao.dev/bore/v2/cmd/bore-cli@latest

Usage

You can use bore the same way you would use pbcopy on Mac or xclip on Linux. For example, the command below will read from a file using cat and copy the result with bore.

cat path/to/file | bore copy

Alternative method: bore copy -i /path/to/file

  • Piping directly into bore:
echo 'Hello world' | bore copy

[!NOTE] If you run bore copy directly, it will prompt you to type in your text

  • Pasting in a file
bore paste > /path/to/file

Alternative method: bore paste -o /path/to/file

Why...

Why does this exist?

At work, I work on a server where I don't have a system clipboard or install permissions to add one, and asking my manager to install other clipboard tools would seemingly pull in other dependencies we don't need. I need a clipboard so I can copy across tabs and sessions in Neovim (while in and not in Zellij), so I made one (you can find the Neovim plugin I use here)

Why does it use a database?

For efficient search, querying, syncing etc (other future features) and... SQLite is just cool. It is also just easier than trying to re-implement a database on a plain text or JSON file anyway (which will happen eventually when you set out to make something like this). Also, it is your data, you can just grab that database file and query it as you wish from other applications.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bore

type Bore struct {
	// contains filtered or unexported fields
}

func New

func New(config *Config) (*Bore, error)

New creates a new Bore instance with the provided configuration.

func (*Bore) Clipboard

func (b *Bore) Clipboard() *clipboardNamespace

Clipboard returns the items namespace for managing clipboard items.

func (*Bore) Close

func (b *Bore) Close() error

func (*Bore) Collections

func (b *Bore) Collections() *collectionNamespace

func (*Bore) Config

func (b *Bore) Config() (*Config, error)

Config returns the configuration of the Bore instance.

func (*Bore) DB

func (b *Bore) DB() (*bun.DB, error)

func (*Bore) Events

func (b *Bore) Events() (*events.Manager, error)

func (*Bore) Get

func (b *Bore) Get(ctx context.Context, options GetClipboardOptions) (PasteResult, error)

Get retrieves the last copied data from the Bore instance.

func (*Bore) Repository

func (b *Bore) Repository() (repository.Repository, error)

Repository returns the current repository implementation for the current Bore instance.

func (*Bore) Reset

func (b *Bore) Reset() error

func (*Bore) SystemClipboard

func (b *Bore) SystemClipboard() (clipboard.NativeClipboard, error)

SystemClipboard returns the native clipboard interface for the current platform.

type Config

type Config struct {
	// DataDir is the path to the storage directory.
	DataDir string `toml:"data_dir" json:"data_dir"`

	// ClipboardPassthrough enables passing the bore clipboard data to the native clipboard on copy
	ClipboardPassthrough bool `toml:"clipboard_passthrough" json:"clipboard_passthrough"`

	// DefaultCollection is the name of the default collection to use when none is specified
	DefaultCollection string `toml:"default_collection" json:"default_collection"`
}

NOTE: where and show the configuration is stored is determined by the application layer.

func DefaultConfig

func DefaultConfig() Config

DefaultConfig returns the default configuration for the bore application.

func (*Config) FromBytes

func (c *Config) FromBytes(data []byte) (*Config, error)

FromBytes reads the configuration from a byte slice and populates the Config struct.

func (*Config) SetDefaultCollection

func (c *Config) SetDefaultCollection(identifier string) error

func (*Config) TOML

func (c *Config) TOML() ([]byte, error)

TOML exports the configuration to a byte slice in TOML format.

type CreateCollectionOptions

type CreateCollectionOptions struct {
	Name                 string
	AppendSuffixIfExists bool
}

type CreateCollectionResult

type CreateCollectionResult struct {
	Name string
	ID   string
}

type GetClipboardOptions

type GetClipboardOptions struct {
	ItemID              string // Optional item identifier to filter pasted items.
	CollectionID        string // Optional collection ID to filter pasted items.
	FromSystemClipboard bool   // Whether to paste from the system clipboard if available.
	DeleteAfterPaste    bool   // Whether to delete the pasted item after pasting.
	SkipCollectionCheck bool   // Whether to skip checking if the collection exists.
}

type ListCollectionsOptions

type ListCollectionsOptions struct {
	OrderBy    []repository.OrderBy
	Pagination *repository.Pagination
}

type PasteResult

type PasteResult struct {
	Content []byte
	Item    *models.Item
}

type SetClipboardOptions

type SetClipboardOptions struct {
	Passthrough  bool   // Whether to also copy to the system clipboard if available.
	CollectionID string // Optional collection ID to associate with the copied item.
	Mimetype     mimetype.MimeType
}

Jump to

Keyboard shortcuts

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