diff options
author | Alasdair Colley <alnessy@hotmail.com> | 2014-07-17 17:39:07 +0200 |
---|---|---|
committer | Alasdair Colley <alnessy@hotmail.com> | 2014-07-17 17:39:07 +0200 |
commit | 4db9994d7ccf66038198bdfe184dd610515ccb28 (patch) | |
tree | ddafdcd5ec09028058119f9a72753471147dc7dd | |
parent | c4acf3fba0c35e236bf4b248d0810ab364f34a14 (diff) |
adding count optin
-rwxr-xr-x | saucypy | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -20,6 +20,7 @@ def parse_args(): parser = optparse.OptionParser( usage = "!source <term> | !source --add <key> <value>" ) parser.add_option( "-a", "--add", action = "store", nargs = 2 ) parser.add_option( "-i", "--index", action = "store", type = int ) + parser.add_option( "-c", "--count", action = "store_true" ) parser.add_option( "-v", "--version", action = "store_true" ) return parser.parse_args( args ) @@ -40,6 +41,8 @@ def main(): entries[key] = value json.dump( entries, open( ENTRIES_FILE, "w" ), indent = 4, sort_keys = True ) + elif options.count: + print "Entries: {0}".format( len( entries.keys() ) ) else: if not args: print "Expected a search argument, got nothing." |