この資料は Rust 製のコマンドラインツール bp について紹介するものです。
Rustの環境構築やツールのインストール方法については以下を参照してください
bp は cb をベースに Rust で書かれたクロスプラットフォームなクリップボードツールです。コピーかペーストかを自動的に判断することができ、パイプで動作するように最適化されています。動作は tee コマンドをベースにしています。
GitHub - printfn/bp: Cross-platform clipboard tool
# copy some text
echo "some text" | bp
# copy the HTML from `example.com`
curl <https://example.com> | bp
# copy the contents of `file.txt`
bp file.txt
# you can also pipe in a file
bp <file.txt
# 標準出力に貼り付ける
bp
# パイプへ貼り付ける
bp | jq | less
# `out.txt`ファイルへ貼り付ける
bp >out.txt
パイプ
# コピーしたテキストから書式を削除する
bp | bp
# 整形して、コピー、表示する
cat example.json | jq | bp | less
# クリップボードの内容を16進エンコードする
bp | xxd | bp
bp のヘルプメッセージ (トグル表示)
% bp --help
Usage: bp [FLAGS] [file]
Flags:
-h --help show usage information
-O --stdout print clipboard contents to stdout
-E --stderr print clipboard contents to stderr