#ulid #parse #generate #command-line-tool #u64 #github #utility

app ruggine_ulid

用于生成和解析 ULID 的命令行工具。 (https://github.com/ulid/spec)

3 个版本

0.1.2 2019 年 3 月 29 日
0.1.1 2019 年 3 月 19 日
0.1.0 2019 年 3 月 19 日

#16#ulid

MIT/Apache

12KB
113 代码行

ruggine-ulid

OysterPack 的 ruggine 项目大量使用 ULIDs。此项目提供了一个简单的命令行工具来生成和解析 ULID。

安装

cargo install ruggine-ulid

CLI

ruggine-ulid 0.1.0
Alfio Zappala 
Command line utility to generate and parse a ULID (https://github.com/ulid/spec).

Output format: `ulid_str u128 (u64, u64) ulid_timestamp_rfc3339`

USAGE:
    ruggine-ulid 

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    generate    generate new ULID
    help        Prints this message or the help of the given subcommand(s)
    parse       parse ULID represented as either a string, u128 number, or (u64, u64) tuple - ULID strings are
                leniently parsed as specified in Crockford Base32 Encoding (https://crockford.com/wrmg/base32.html)

示例

# generate new ULID
> ruggine-ulid generate
01D6989F6P0TGQ8NH3K64EH6TD 1877390914292581084991991368823380813 (101773565394028193, 8382926898730670925) 2019-03-18T20:36:06.486Z

# parse a ULID string
> ruggine-ulid parse 01D6989F6P0TGQ8NH3K64EH6TD
01D6989F6P0TGQ8NH3K64EH6TD 1877390914292581084991991368823380813 (101773565394028193, 8382926898730670925) 2019-03-18T20:36:06.486Z

# parse a ULID represented as u128
> ruggine-ulid parse 1877390914292581084991991368823380813
01D6989F6P0TGQ8NH3K64EH6TD 1877390914292581084991991368823380813 (101773565394028193, 8382926898730670925) 2019-03-18T20:36:06.486Z

# parse a ULID represented as (u64, u64)
> ruggine-ulid parse 01D6989F6P0TGQ8NH3K64EH6TD
01D6989F6P0TGQ8NH3K64EH6TD 1877390914292581084991991368823380813 (101773565394028193, 8382926898730670925) 2019-03-18T20:36:06.486Z

依赖项

~9MB
~150K SLoC