Skip to content

Instantly share code, notes, and snippets.

@zacjones93
Created October 28, 2022 20:27
Show Gist options
  • Save zacjones93/e5d005d13adcdc84917611eb9a98ace6 to your computer and use it in GitHub Desktop.
Save zacjones93/e5d005d13adcdc84917611eb9a98ace6 to your computer and use it in GitHub Desktop.
// Author: Zac Jones
import "@johnlindquist/kit"
let input = await arg("paste in SMTP training")
let split = input.split(/(LIFTING:)|(WORKOUT:)|(WARM UP:)|(COOL DOWN:)/).filter((v) => !!v).reduce((prev, curr, i, arr) => {
if (i % 2 === 0) {
let key = curr.split(":")
return {
...prev,
[key[0]]: ''
}
} else {
let key = arr[i - 1].split(":")
return {
...prev,
[key[0]]: curr
}
}
}, {})
let tanaWorkouts = ['%%tana%%\n']
Object.keys(split).map((key) => {
let workout = `
- ${key} #workout
- Description:: ${split[key]}
- Programming:: [[SMTP]]`
- Movements::
- Score Scheme::
- Time Scheme::
- Rep Scheme::
`
tanaWorkouts.push(workout)
})
copy(tanaWorkouts.join(""))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment