4 个版本
0.1.3 | 2023年5月25日 |
---|---|
0.1.2 | 2023年5月24日 |
0.1.1 | 2023年5月23日 |
0.1.0 | 2023年5月23日 |
#2431 在 命令行工具
48 每月下载次数
21KB
263 行
粘贴 CLI
一个命令行工具,用于将文件上传到 pastes.dev 或 bytebin.lucko.me
程序将尝试根据扩展名确定文件类型,从而确定是否应该上传到代码粘贴板或
用法
pastes
可以作为一个单独的命令运行
$ pastes my_text_file.txt # Upload a text file to pastes.dev
$ pastes my_image.png # Upload an image to bytebin.lucko.me
$ pastes my_unknown_file # Upload to bytebin
$ pastes my_unknown_file --pastes # Upload to pastebin (read the file as plaintext)
$ pastes my_unknown_file --bytebin # Upload to bytebin
$ pastes ... -t application/json # Force application/json mime type
或者,它可以在管道中运行
$ echo "hello" | pastes --json | jq '.url'
$ cat my_file.txt | pastes -t text/plain
# Is equivalent to
$ pastes my_file.txt -t text/plain
有关完整用法,请参阅 pastes --help
平台
虽然此项目是针对 Linux 构建的,但从理论上讲,它应该可以在其他平台上运行。
安装
cargo install pastes
待办事项
待办事项列表上的几项
- 添加从 pastes.dev 和 bytebin 下载的功能
- 或者检测 URL 本身,或者添加一个
--download
标志,将文件作为 URL 或密钥处理 - 使用
mime2ext
包来猜测文件扩展名并将其写入该扩展名
- 或者检测 URL 本身,或者添加一个
- 可能切换到 tokio 和非阻塞 reqwest 以允许流
- 通过 reqwest 的流功能(需要 tokio)
- 添加使用替代位置托管粘贴/bytebin 实例的功能
- 更多 MIME 类型匹配以确定要使用哪个服务
贡献
如果您发现错误或有功能想法,请随时提交问题或拉取请求。我始终愿意帮助所有项目!
依赖项
~5–21MB
~283K SLoC