22个版本
0.2.2 | 2022年2月26日 |
---|---|
0.2.1 | 2022年1月9日 |
0.2.0 | 2021年12月26日 |
0.1.18 | 2021年12月9日 |
0.1.10 | 2021年8月31日 |
#443 in Cargo插件
66 个月下载次数
180KB
5K SLoC
cargo-pipe
是一个基于 clap
的命令行工具,用于生成和构建带有清单的 pipebase
应用程序
安装工具
安装Rust和Cargo(Rust最低支持版本1.54.0)
curl https://sh.rustup.rs -sSf | sh
安装 rustfmt
rustup component add rustfmt
安装 cargo-pipe
命令行界面
cargo install cargo-pipe
用法
cargo pipe --help
快速入门
克隆仓库并进入 resources
目录
git clone https://github.com/pipebase/pipebase.git && \
cd pipebase/cargo-pipe/resources && \
cargo pipe new && \
cargo pipe validate -o -p && \
cargo pipe generate && \
cargo pipe build -o timer -r
运行应用程序
./timer
注意,对 pipe.yml
的任何更改都需要重新运行 validate
、generate
、build
步骤
验证与调试
仅验证清单
cargo pipe validate -o -p
带有调试标志构建
cargo pipe build -d
...
Warning struct is never constructed: `Bar`
Warning 1 warning emitted
通过删除 objects
部分来解决警告
@@ -23,13 +23,6 @@ pipes:
config:
ty: PrinterConfig
upstreams: [ "timer1", "timer2" ]
-objects:
- - ty: Bar
- fields:
- - name: bar1
- ty: Integer
- - name: bar2
- ty: String
由于清单已更改,重新生成和构建
cargo pipe generate && \
cargo pipe build -d
描述清单
列出所有管道和对象
cargo pipe describe -a
...
Describe pipes
Result pipe: timer1, printer, timer2
Describe objects
Result objects: Bar
描述一个管道
cargo pipe describe -p timer1
...
Describe pipe timer1
Result
Name: timer1
Type: poller
Config: { type: TimerConfig, path: catalogs/timer1.yml }
Upstream: []
描述一个对象
cargo pipe describe -o Bar
...
Describe object Bar
Result
Type: Bar
Type Metas:
Fields:
Name Type Metas
bar1 i32
bar2 String
描述跨管道的管道
cargo pipe describe -l printer
...
Describe pipelines for printer
Result pipeline: timer2(u128) -> printer
Result pipeline: timer1(u128) -> printer
依赖项
~5–15MB
~170K SLoC