2 个版本
0.1.1 | 2023年11月12日 |
---|---|
0.1.0 | 2023年11月12日 |
#2130 在 解析实现
12KB
202 行
锻炼笔记解析器
是否曾想将您的锻炼数据从文件中解析出来?现在您可以做到了!看看这个示例锻炼笔记
Name of the first exercise
20 x 10 This is a comment. There you write
30 x 10 how you felt during the exercise,
40 x 10 like "this was close to the edge"
50 x 10 or "this was easy, better increase the weight".
60 x 10 The first number is the weight, the second is the number of reps.
70 x 10 + 40 x 6 Sometimes you do all you can with one weight and then
80 x 10 immediately you take a smaller weight and do a few more reps.
90 x 10 You can write it as well
bench press
20 x 10
50 x 10
60 x 10 near death experience
70 x 5 + 40 x 10
现在您可以将其解析到整洁的数据结构中
struct Set {
weight: f32,
n_reps: i32,
}
struct Exercise {
name: String,
sets: Vec<Set>,
comment: Option<String>,
}
用法
按照以下方式使用命令
cargo install workout-note-parser
workout-note-parser -i - < input.txt > output.txt
workout-note-parser -i input.txt > output.txt
workout-note-parser -i input.txt -o output.txt
然后您可以使用输出(JSON 格式)来绘制您的进度,例如,使用 ChatGPT 数据分析工具。或者自己编写一个绘图器。
许可证
MIT 许可证
依赖项
~9.5MB
~164K SLoC