musicmatze :rust: :nixos: on Nostr: Doing #rust code generation like a pro: ``` cat src/base.rs | grep "serde(rename" -A ...
Doing #rust code generation like a pro:
```
cat src/base.rs | grep "serde(rename" -A 1 | grep -v op_id | grep -v opId | grep -E ",$" | cut -d "(" -f 1 | sed 's,^\ *,,' | while read name; do echo "#[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct $name { }" > src/operation/"$(echo "$name" | tr '[A-Z]' '[a-z]')".rs ; done
```
```
cat src/base.rs | grep "serde(rename" -A 1 | grep -v op_id | grep -v opId | grep -E ",$" | cut -d "(" -f 1 | sed 's,^\ *,,' | while read name; do echo "#[derive(Debug, serde::Serialize, serde::Deserialize)] pub struct $name { }" > src/operation/"$(echo "$name" | tr '[A-Z]' '[a-z]')".rs ; done
```