2019年11月7日 星期四
Joshua Conero
基于 rust 与 golang 的代码编写常用的命令行工具。rust 语言的启发项目:deno, rocket.
# 打开本地文档
rustup doc
代码仓库,初始化如下:
# 使用 fmt 格式化代码
# 安装组件
rustup component add rustfmt
# 格式化
cargo fmt
# 格式化并显示详情
cargo fmt --all -v
# 运行
# 格式
# yysh [command] [option]
# yysh [option]
yysh
# 选项
(-xyz, --xyz, --test, --any) => [x, y, z, xyz, test, any]
# 数据
--key=value, "key=value", "key=value&key2=value"
与使用 ,Rocket 类似的宏实现路由,考虑的复杂性先使用简单的回调函数实现。