4 个稳定版本
使用旧的 Rust 2015
2.0.0 | 2017年6月11日 |
---|---|
1.2.0 | 2016年7月16日 |
1.1.0 | 2016年6月27日 |
1.0.0 | 2016年6月22日 |
#836 在 开发工具
94KB
2.5K SLoC
bins
终端粘贴工具。
支持 GitHub Gist、Pastebin、hastebin、sprunge、Bitbucket snippets 和 fedora pastebin。
安装
bins 使用最新的 Rust nightly 构建。可以使用其他版本,但性能可能会有所不同。
发布
无 Rust
不想安装 Rust?可能可以在 最新发布版 中找到适用于您架构的预编译二进制文件。
Rust
如果您想从 crates.io 安装最新版本
# If you don't have Rust installed:
# curl https://sh.rustup.rs -sSf | sh
cargo install bins
开发
从源代码构建需要使用 nightly 编译器!
要求
根据您启用的 bins 功能,从源代码构建 bins 需要不同的要求。
- openssl
- libssl-dev
- clipboard_support
- Linux 上的 xorg-dev
- file_type_checking
- libmagic-dev
- rustls
- 无要求
如果您想从仓库安装最新版本
git clone https://github.com/jkcclemens/bins
cd bins
# If you don't have Rust installed:
# curl https://sh.rustup.rs -sSf | sh
cargo install
将 $HOME/.cargo/bin
添加到您的 $PATH
或将 $HOME/.cargo/bin/bins
移动到 /usr/local/bin
。
升级
要从 crates.io 升级现有安装
cargo install --force bins
要从源代码升级现有安装
cd bins
git fetch origin && git reset --hard origin/master
cargo install --force
用法
要获取帮助,请使用 bins -h
。bins 接受多个文件的列表、字符串或管道数据。
请查看以下一些编写示例
示例
从 stdin 创建粘贴
$ echo "testing123" | bins -b gist
https://gist.github.com/fa772739e946eefdd082547ed1ec9d2c
从文件创建粘贴
粘贴单个文件
$ bins -b gist hello.c
https://gist.github.com/215883b109a0047fe07f5ee229de6a51
bins 支持粘贴多个文件。通过像 GitHub 的 gist 这样的服务,这些功能是原生支持的。对于不支持多文件粘贴的服务,将创建并返回一个索引粘贴,该粘贴链接到每个文件的单独粘贴。
$ bins -b gist hello.c goodbye.c
https://gist.github.com/anonymous/7348da5d3f1cd8134d7cd6ee1cf5e84d
指定可见性选项
默认情况下,bins 会使用配置文件中的 defaults.private
选项来确定是否创建私有粘贴。此选项的默认值为 true
- 因此新粘贴将是私有的。您可以在命令行中覆盖此设置
$ bins --public --bin gist hello.c
https://gist.github.com/05285845622e5d6164f0d36b73685b19
配置
至少运行一次 bins 将生成一个配置文件。其位置取决于 bins 运行的环境。配置文件将创建在以下列表中的第一个可用位置
$XDG_CONFIG_DIR/bins.cfg
$HOME/.config/bins.cfg
$HOME/.bins.cfg
如果这些路径都不可用($XDG_CONFIG_DIR
和 $HOME
都未设置或不可写),bins 将失败且不会生成配置文件。
生成配置文件时将对其进行文档记录,因此请检查文件以获取配置文档。
依赖关系
~8–13MB
~298K SLoC