Git Product home page Git Product logo

yank's Introduction

yank

Yank terminal output to clipboard.

yank

Description

Read input from stdin and draw a selection interface where all fields in the given input is recognized by using a given set of delimiters which defaults to space (new line, carriage return and tab characters are always treated as delimiters). The delimiters is a sequence of characters represented as a string and can be overwritten using the -d option.

Using the Ctrl-N and Ctrl-P keys will move the field selection forward and backward. The interface support several Emacs like key bindings, consult the man page for further reference. Pressing the return key will invoke the yank command and write the selected field to its stdin. The yank command defaults to xsel[1] but could be anything that accepts input on stdin. When invoking yank everything supplied after the -- option will be used as the yank command, see examples below. The default yank command can also be defined at compile time, see compilation below.

Motivation

Others including myself consider it a cache miss when resort to using the mouse. Copying output from the terminal is still one of the few cases where I still use the mouse. Several terminal multiplexers solves this issue, however I don't want to be required to use a multiplexer but instead use a terminal agnostic solution.

Examples

  • Yank a environment variable key or value:

    env | yank -d =
    
  • Yank a field from a CSV file:

    yank -d \", <file.csv
    
  • Yank a whole line using the -l option:

    make 2>&1 | yank -l
    
  • If stdout is not a terminal the selected field will be written to stdout and exit without invoking the yank command:

    yank | cat
    
  • Yank the selected field to the clipboard as opposed of the default primary clipboard:

    yank -- xsel -b
    

Compilation

Run the following command:

make

The default yank command can be defined using the YANKCMD environment variable. Example: OS X users would use pbcopy as the default yank command:

YANKCMD=pbcopy make

Alternatively put the YANKCMD variable declaration in your local config.mk file.

Installation

The install directory defaults to /usr/local:

make install

Change the install directory using the PREFIX environment variable:

PREFIX=DIR make install

[1] http://www.vergenet.net/~conrad/software/xsel/

yank's People

Contributors

mptre avatar bjarneh avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.