heroku/heroku-pg-extras — pull request #74 by deafbybeheading (2014-03-20 03:51:26+00:00)
Title: Use helper method to reduce code duplication

Most of `heroku-pg-extras` is handy queries aliased as heroku CLI commands, and the pattern to introduce a new one is very formulaic: call `track_extra` with the method name if tracking is turned on, call `exec_sql` with the query text, and print the result. This wraps this sequence in a helper method to make sure that we track all new queries, that we never track if tracking is turned off, and to make it easier to introduce new common changes.