Skip to content

Instantly share code, notes, and snippets.

@fanaugen
Last active June 8, 2017 14:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fanaugen/c96693ec9dea17ea9b08 to your computer and use it in GitHub Desktop.
Save fanaugen/c96693ec9dea17ea9b08 to your computer and use it in GitHub Desktop.
rake tasks to wiki
#!/bin/bash
# Run `rake -D` and format the task descriptions as a
# GitHub-Markdown table (for our Wiki)
# Write the output to tasks.md
touch tasks.md
echo '<dl>' > tasks.md
bundle exec rake -D |
sed -E '/^rake .*$/{ $! { N;
s/^(rake .*)(\n)[[:space:]]+(.*)/<dt> \1\2<dd> \3/;
};};
/^$/d;' |
sed -nE '1h; 1!H; ${ g;
s/\n([^<])/<br>\1/g;
s/ +/ /g;
p;
}' >> tasks.md
echo '</dl>' >> tasks.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment