Last active
August 29, 2015 14:06
-
-
Save jpalala/7b2d9eca1d91c1a8ae6b to your computer and use it in GitHub Desktop.
TODON(e)D - simple way to record your git logs as a DONETHIS file and put in your TODO.md list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import os, sys | |
import getopt | |
"""TODO: upload to idonethis.com [feature]""" | |
"""TODO: check if git repository (no dones will be posted if not a repo) [improvement]""" | |
def main(): | |
"""remove file DONE.THIS.md if it exists""" | |
try: | |
os.remove("DONE.THIS.md") | |
except OSError: | |
pass | |
"""Determine if skip or load todo list file""" | |
try: | |
opts, args = getopt.getopt(sys.argv[1:], "sf", ["skip", "file="]) | |
except getopt.GetoptError as err: | |
#print some help | |
print "Use -s to skip or --file= to specify todo" | |
sys.exit(2) | |
for o, a in opts: | |
if o == "-s": | |
os.system("echo skipping writing todo list into donethis log") | |
elif o in ("-f", "--file"): | |
os.chdir(os.getcwd()) | |
os.system("Outputting TODO list first") | |
os.system("echo TODO's \r\n:") | |
todofile = a | |
os.system("cat %s > DONE.THIS.md", todofile) | |
"""Generating dones from the git log""" | |
os.system('git log --pretty=format:"[x] %an -> %s , about %ar " >> DONE.THIS.md' ) | |
sys.exit(2) | |
else: | |
assert False, "unhandled option" | |
sys.exit(2) | |
os.system("cat TODO.md > DONE.THIS.md") | |
os.system('git log --pretty=format:"[x] %an -> %s , about %ar " >> DONE.THIS.md' ) | |
if __name__ == "__main__": | |
main() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Copy this script into
/usr/bin/todond
and make it executable so you can just run $todond
(on the terminal / cmdline)