#硬币 #列表 #骰子 #随机 #命令行工具

bin+lib rndmator

命令行实用程序,用于掷硬币、掷骰子和从列表中随机选择

1 个不稳定版本

0.1.0 2021年7月20日

#11#硬币

GPL-3.0 许可证

19KB
157 代码行

rndmator

从列表中随机选择、掷骰子或掷硬币的命令行实用程序。

安装

cargo install rndmator

用法

rndmator 0.1.0
Aman Harwara <amanharwara@protonmail.com>
Command-line utility to randomly choose from a list, roll dice or toss a coin.

USAGE:
    rndmator [OPTIONS] [SUBCOMMAND]

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

OPTIONS:
    -r, --repeat <n>    Repeat action <n> number of times

SUBCOMMANDS:
    -c, coin      Toss a coin
    -d, dice      Roll a dice
    -l, list      Randomly choose an item from a list
    -n, number    Random number between range
    help          Prints this message or the help of the given subcommand(s)

掷硬币

USAGE:
    rndmator {coin, -c} [OPTIONS]

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

OPTIONS:
    -r, --repeat <n>         Repeat action <n> number of times
    -t, --tosses <tosses>    Number of tosses [default: 1]

掷骰子

USAGE:
    rndmator {dice, -d} [OPTIONS]

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

OPTIONS:
    -r, --repeat <n>       Repeat action <n> number of times
    -s, --sides <sides>    Number of sides of the dice [default: 6]

从列表中选择

USAGE:
    rndmator {list, -l} [OPTIONS] <LIST>

ARGS:
    <LIST>    The list to choose an item from

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

OPTIONS:
    -a, --amount <amount>      Amount of items to choose from list [default: 1]
    -d, --delim <delimiter>    The delimiter used to separate items [default: ,]
    -r, --repeat <n>           Repeat action <n> number of times

在范围内生成随机数

USAGE:
    rndmator {number, -n} [OPTIONS] <RANGE>

ARGS:
    <RANGE>    Range to choose from. e.g. 1..10

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

OPTIONS:
    -r, --repeat <n>    Repeat action <n> number of times

依赖项

~3.5–5MB
~81K SLoC