Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theden/gcopy
Copy data to your clipboard via the command line (including images, archive files, videos etc.) 📋
https://github.com/theden/gcopy
clipboard command-line macos pbcopy terminal
Last synced: 2 months ago
JSON representation
Copy data to your clipboard via the command line (including images, archive files, videos etc.) 📋
- Host: GitHub
- URL: https://github.com/theden/gcopy
- Owner: TheDen
- License: gpl-2.0
- Created: 2022-11-26T15:51:42.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-15T11:21:07.000Z (5 months ago)
- Last Synced: 2024-08-15T13:01:54.193Z (5 months ago)
- Topics: clipboard, command-line, macos, pbcopy, terminal
- Language: Go
- Homepage:
- Size: 3.53 MB
- Stars: 13
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gcopy
![Go Version](https://img.shields.io/github/go-mod/go-version/TheDen/gcopy?style=flat-square&logo=go)
[![Go Doc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square&logo=go)](https://pkg.go.dev/github.com/TheDen/gcopy)
[![Prettier](https://img.shields.io/badge/Prettier-%23F7B93E.svg?style=flat-square&logo=prettier&logoColor=black)](https://github.com/prettier/prettier)
[![GitHub Release](https://img.shields.io/github/v/release/TheDen/gcopy?style=flat-square&logo=github)](https://github.com/TheDen/gcopy/releases/latest)
[![CI status](https://img.shields.io/github/actions/workflow/status/TheDen/gcopy/ci.yaml?branch=main&style=flat-square&logo=github)](https://github.com/TheDen/gcopy/actions?query=branch%3Amain)
[![License](https://img.shields.io/github/license/TheDen/gcopy?style=flat-square)](/LICENCE)`gcopy` (global copy) is a command line tool that copies data to your clipboard on MacOS.
It does what `pbcopy` does but with some extra features:
- Works with images, so copied images can be pasted in other applications
- Accepts arbitrary `STDIN` via a pipe
- If a filename is passed as an argument it'll copy the data as though you hit `CMD+C` via `Finder`, allowing pasting of files (PDFs, archive files, videos etc.) to other programs
- Has an optional flag to copy the absolute pathname of a file or folder to the clipboard
- Written in Go, deployed as a multi-arch static binary
- Works as a drop-in replacement for `pbcopy` since it extends its features![gcopy](./gcopy-usage-example.gif)
# Install
## Via `go install`
```shell
go install github.com/TheDen/gcopy@latest
```## Brew
To install via `brew`
```shell
brew tap theden/gcopy
brew install gcopy
```# Aliasing
`gcopy` can be used as a drop-in replacement for `pbcopy`. To do this, add the `alias` into your `.bashrc` or similar
```shell
alias pbcopy='gcopy'
```# Usage
## Overview
```bash
usage: gcopy [file] [STDIN] [-h|--help] [-v|--version] [-p|--path]gcopy: copy content to the clipboard
Arguments:
-h --help Print help information
-v --version Current version
-p --path Copy (and show) the absolute pathname of a file or folder to
the clipboard
```## Copying to clipboard via STDIN
Works with text or arbitrary data
```shell
cat main.go | gcopy
# or
gcopy < main.go
```Images can also be copied via pipes, and then pasted as images to GUI applications
```shell
cat image.png | gcopy
# or
gcopy < image.png
```## Passing in files to copy to the clipboard
```shell
gcopy main.go
```Similarly for images
```shell
gcopy image.png
```Or any other type of file
```shell
gcopy backups.zip
```Copying via this method will allow you to paste non-text data in other applications
## Getting the absolute path of a file or folder
```shell
gcopy -p .bashrc
/Users/den/.bashrc
```