#clipboard #transformation #shell #transform #filter #content #user-defined

app cbt

Command-line tool that transforms new clipboard content with a series of user-defined shell filters and prints the result

1 unstable release

Uses old Rust 2015

0.1.0 Aug 3, 2018

#38 in #user-defined

MIT license

6KB
90 lines

Build Status

cbt - clipboard transformations

The clipboard transformer retrieves new values from the system clipboard and runs them through a series of user-defined transformations.

These transformations can be either inline shell commands like sed s/a/b/g or arbitrarily complex shell commands.

Examples

Print the current clipboard value as soon as it changes.

$ cbt

Transform as to As and bs to Bs.

$ cbt 'sed s/a/A/g' 'sed s/b/B/g'

Pretty-print JSON-content in the clipboard using jq.

$ cbt 'jq .'

Count how many words are separated by a , (works for the macOS version of sed).

$ cbt "sed 's/,/\'$'\n/g'" "wc -l"

If the clipboard content matches "foo", run it through your super-complex Python filter.

$ cbt 'grep foo' ./super_complex_filter.py

Shoot yourself in the foot with an infinite loop.

$ cbt 'xargs echo "haha "' pbcopy

Installation

From source

The source install requires that you have the Rust compiler installed. Once it is present, run:

$ git clone git@github.com:Sh4pe/cbt.git
$ cd cbt
$ cargo install

This installs cbt to your $CARGO_HOME/bin directory.

Dependencies

~0–5.5MB
~14K SLoC