3个版本
| 0.1.3 | 2022年10月23日 | 
|---|---|
| 0.1.2 | 2022年10月22日 | 
| 0.1.1 | 2022年10月20日 | 
#5 in #kebab-case
12KB
267 行
kase
将一种大小写转换为另一种。输入大小写基于最佳猜测确定,但可以用 --from 标志覆盖。
安装
cargo install kase
用法
示例
$ kase snake MyVariable
my_variable
$ kase screaming-snake my_variable
MY_VARIABLE
$ kase kebab MY_VARIABLE
my-variable
$ kase path my-variable
my/variable
$ kase dot my/variable
my.variable
$ kase camel my.variable
myVariable
$ kase pascal myVariable
MyVariable
$ # If the best-guess for an input isn't right for your use case, you can use the `--from` flag:
$ kase dot my_dir/my_path
my.dir/my.path
$ kase --from path dot my_dir/my_path
my_dir.my_path
选项
$ kase -h
Convert from one case to another. Input case is determined on a best-guess basis, but can be overridden with the --from flag.
Usage: kase [OPTIONS] <CASE> [INPUT]
Arguments:
  <CASE>   Case to convert to [possible values: snake, screaming-snake, kebab, path, dot, camel, pascal, lower]
  [INPUT]  String to convert; if empty, reads from stdin
Options:
  -f, --from <FROM>  Case to convert from, if best-guess isn't working [possible values: snake, screaming-snake, kebab, path, dot, camel, pascal, lower]
      --debug        Debug mode
  -h, --help         Print help information
  -V, --version      Print version information
依赖
~1.3–2MB
~36K SLoC