Project

clip.rb

0.0
The project is in a healthy, maintained state
A command-line tool for copying piped input to the clipboard with options for line limits, markdown wrapping, appending, and echoing output.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 5.0
~> 13.0
~> 1.21
~> 0.9
 Project Readme

clip

A simple clipboard utility for piping content to xclip.

Install

gem install clip.rb

Requires xclip to be installed on your system.

Usage

# Copy file contents to clipboard
cat file.txt | clip

# Copy and echo the content
cat file.txt | clip -e

# Copy only the first N lines
cat file.txt | clip -l 10

# Wrap content in markdown code fence
cat script.rb | clip -m ruby

# Append to existing clipboard content
cat more.txt | clip -a

# Paste clipboard contents to stdout
clip

# Grep outputs filename AND content:
grep -rn "TODO" src/
# src/app.rb:42:# TODO: refactor this
# src/app.rb:87:# TODO: add tests
# src/lib.rb:12:# TODO: fix bug

# Use -l 1 to copy just the first match (with filename)
grep -rn "TODO" src/ | clip -l 1

Options

  • -l, --line NUMBER - Copy only the first N lines
  • -e, --echo - Output copied content to stdout
  • -a, --append - Append to clipboard instead of replacing
  • -m, --markdown [LANGUAGE] - Wrap in markdown code fence
  • -h, --help - Print help

Contributing

Bug reports and pull requests are welcome on GitHub.

Development

After checking out the repo:

bin/setup
bundle exec rake test

License

The gem is available as open source under the terms of the MIT License.