# -*- coding: utf-8 -*-

import sys, datetime, getopt
from reddit_user import RedditUser

longopts, shortopts = getopt.getopt(sys.argv[2:], shortopts="", longopts=["file="])
args = dict(longopts)

file_mode = ""

if len(sys.argv) < 2:
	sys.exit("Usage: python sherlock.py <username> --file=(read|write)")

if args.has_key("--file") and args["--file"] == "write":
    file_mode = "write"
elif args.has_key("--file") and args["--file"] == "read":
	file_mode = "read"

start = datetime.datetime.now()

u = RedditUser(sys.argv[1])

if file_mode == "write":
	u.save_comments_to_file()
	u.process_comments_from_file()
elif file_mode == "read":
	u.process_comments_from_file()
else:
	u.process_all_comments()

print u
print "Processing complete... %s" % (datetime.datetime.now()-start)
@@ -519,16 +519,56 @@
 argv%5B1%5D)
+%0Aprint %22Processing user %25s%22 %25 u.username
 %0A%0Aif fil
@@ -728,19 +728,121 @@
 all_
-comments()%0A
+submissions()%0A%09u.process_all_comments()%0Awith open(%22results/%25s.txt%22 %25 u.username,%22w%22) as o:%0A%09o.write(str(u))%0Aprint
 %0Apri
@@ -845,32 +845,34 @@
 %0Aprint u%0Aprint %22
+%5Cn
 Processing compl

Write output to text file