1 个不稳定版本
0.1.1 | 2024年2月25日 |
---|
#82 在 值格式化
25KB
305 行
human-ids
创建简单的可读性强的ID
什么是?
这是一个由RienNeVaPlus编写的TypeScript/JavaScript库 human-id
的Rust "分支",仅用Rust重写。用于生成类似于在 changesets
中使用的友好ID。可以作为库或二进制文件使用。
库
安装
- 添加id:
cargo add human_ids
- 使用它:
use human_ids::generate(None)
用法
有关用法文档,请参阅 docs.rs 页面。
二进制文件
用法
$ human_ids -h
Usage: human_ids [OPTIONS]
Options:
--completion <COMPLETION>
Generate shell completion scripts [possible values: bash, elvish, fish, powershell, zsh]
-s, --separator <SEPARATOR>
The separator to use between words [default: -]
-c, --capitalize
Capitalize each word
-a, --adverb
Add an adverb
-n, --num-adjectives <NUM_ADJECTIVES>
The number of adjectives to use [default: 1]
-h, --help
Print help (see more with '--help')
-V, --version
Print version
$ human_ids -s '~' -c
Happy~Mirrors~Matter
补全
如果您的安装方法不包括shell补全,您可以使用 human_ids --completion <shell>
命令手动源或保存它们。
帮助
最后,使用 human-ids -h
(或如果您安装了man页面,则为 --help
)始终可以获得帮助。
安装
目前,该软件包在几个地方可用,包括Homebrew、AUR和Nix。
- Cargo
cargo安装 human-ids-bin
- Homebrew
-
brewtap sondr3/homebrew-taps
brew安装 human-ids-bin
您还可以从 发布标签 下载相应的发布版本,解压缩存档并将二进制文件放在您的 $PATH
中。请注意,对于Linux,建议使用 unknown-linux-musl.tar.gz
,因为它静态链接,因此应在任何Linux发行版上运行。
许可证
MIT。
依赖关系
~1.3–2MB
~37K SLoC