Skip to content

Instantly share code, notes, and snippets.

@jpalala
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpalala/7b2d9eca1d91c1a8ae6b to your computer and use it in GitHub Desktop.
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
#!/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()
@jpalala
Copy link
Author

jpalala commented Sep 8, 2014

Copy this script into /usr/bin/todond and make it executable so you can just run $ todond (on the terminal / cmdline)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment