Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nakabonne/pbgopy
Copy and paste between devices
https://github.com/nakabonne/pbgopy
cli clipboard copy-paste go golang
Last synced: 13 days ago
JSON representation
Copy and paste between devices
- Host: GitHub
- URL: https://github.com/nakabonne/pbgopy
- Owner: nakabonne
- License: mit
- Created: 2020-11-25T12:35:10.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-03-03T14:05:03.000Z (over 2 years ago)
- Last Synced: 2024-05-22T11:32:48.662Z (6 months ago)
- Topics: cli, clipboard, copy-paste, go, golang
- Language: Go
- Homepage:
- Size: 703 KB
- Stars: 799
- Watchers: 16
- Forks: 32
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - pbgopy
README
# pbgopy
[![Release](https://img.shields.io/github/release/nakabonne/pbgopy.svg?color=orange&style=flat-square)](https://github.com/nakabonne/pbgopy/releases/latest)
[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go&logoColor=white&style=flat-square)](https://pkg.go.dev/mod/github.com/nakabonne/pbgopy?tab=packages)`pbgopy` acts like [pbcopy/pbpaste](https://www.unix.com/man-page/osx/1/pbcopy/) but for multiple devices. It lets you share data across devices like you copy and paste.
![Demo](assets/demo.gif)
## Installation
Binary releases are available through [here](https://github.com/nakabonne/pbgopy/releases).#### macOS
```
brew install nakabonne/pbgopy/pbgopy
```#### RHEL/CentOS
```
rpm -ivh https://github.com/nakabonne/pbgopy/releases/download/v0.3.0/pbgopy_0.3.0_linux_amd64.rpm
```#### Debian/Ubuntu
```
wget https://github.com/nakabonne/pbgopy/releases/download/v0.3.0/pbgopy_0.3.0_linux_amd64.deb
apt install ./pbgopy_0.3.0_linux_amd64.deb
```#### Arch Linux
AUR package is available: [pbgopy](https://aur.archlinux.org/packages/pbgopy/)
```
yay pbgopy
```#### Nix
```
nix-shell -p nixpkgs.pbgopy
```#### Go
```
go install github.com/nakabonne/pbgopy@latest
```#### Docker
```
docker run --rm nakabonne/pbgopy pbgopy help
```## Usage
First up, you start the pbgopy server which works as a shared clipboard for devices. It listens on port 9090 by default.
You must allow access to this port for each device you want to share data with.```bash
pbgopy serve
```Populate the address of the host where the above process is running into the `PBGOPY_SERVER` environment variable. Then put the data entered in STDIN into the server with:
```bash
export PBGOPY_SERVER=http://host.xz:9090
pbgopy copy foo.png
```## End-to-end encryption
`pbgopy` comes with a built-in ability to encrypt/decrypt with a variety of keys.### With symmetric-key:
You can derive the key from password with the `-p` flag, which is provided so that you can encrypt/decrypt without previous setting.
```bash
pbgopy copy -p your-password foo.png
```## From clipboard on your OS
You can put the data stored at the clipboard on your OS into pbgopy server.```bash
pbgopy copy -c
```## Command-line options
#### Copy
```
pbgopy copy -h
Copy from stdinUsage:
pbgopy copy [flags]Examples:
export PBGOPY_SERVER=http://host.xz:9090
echo hello | pbgopy copyFlags:
-a, --basic-auth string Basic authentication, username:password
-c, --from-clipboard Put the data stored at local clipboard into pbgopy server
--gpg-path string Path to gpg executable (default "gpg")
-u, --gpg-user-id string GPG user id associated with public-key to be used for encryption
-h, --help help for copy
--max-size string Max data size with unit (default "500mb")
-p, --password string Password to derive the symmetric-key to be used for encryption
-K, --public-key-file string Path to an RSA public-key file to be used for encryption; Must be in PEM or DER format
-k, --symmetric-key-file string Path to symmetric-key file to be used for encryption
--timeout duration Time limit for requests (default 5s)
```#### Paste
```
pbgopy paste -h
Paste to stdoutUsage:
pbgopy paste [flags]Examples:
export PBGOPY_SERVER=http://host.xz:9090
pbgopy paste >hello.txtFlags:
-a, --basic-auth string Basic authentication, username:password
--gpg-path string Path to gpg executable (default "gpg")
-u, --gpg-user-id string GPG user id associated with private-key to be used for decryption
-h, --help help for paste
--max-size string Max data size with unit (default "500mb")
-p, --password string Password to derive the symmetric-key to be used for decryption
-K, --private-key-file string Path to an RSA private-key file to be used for decryption; Must be in PEM or DER format
--private-key-password-file string Path to password file to decrypt the encrypted private key
-k, --symmetric-key-file string Path to symmetric-key file to be used for decryption
--timeout duration Time limit for requests (default 5s)
```#### Serve
```
pbgopy serve -h
Start the server that acts like a clipboardUsage:
pbgopy serve [flags]Examples:
pbgopy serve --port=9090 --ttl=10mFlags:
-a, --basic-auth string Basic authentication, username:password
-h, --help help for serve
-p, --port int The port the server listens on (default 9090)
--ttl duration The time that the contents is stored. Give 0s for disabling TTL (default 24h0m0s)
```## Inspired By
- [nwtgck/piping-server](https://github.com/nwtgck/piping-server)
- [bradwood/glsnip](https://github.com/bradwood/glsnip)