Skip to content

Commit

Permalink
Added list subcommand to dropbox_setup.py
Browse files Browse the repository at this point in the history
Next to `add` and `del` subcommands, StaSh command `dropbox_setup` now also supports list to display inventory of dropbox usernames in the keychain; uses undocumented `keychain.get_services()` function
  • Loading branch information
Dutcho authored Apr 17, 2017
1 parent 9c1622f commit c05e855
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions bin/dropbox_setup.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#! python2
# StaSh utility

"""manage your dropbox configuration."""

import cmd
import keychain
import sys

from stashutils import dbutils
Expand All @@ -20,9 +25,17 @@ def do_exit(self, cmd):
"""exit: quits the setup."""
sys.exit(0)
do_quit = do_EOF = do_exit


def do_list(self, cmd):
"""list: lists the dropbox usernames."""
print
for service, account in keychain.get_services():
if service == dbutils.DB_SERVICE:
print account
print

def do_del(self, cmd):
"""del USERNAME: resets the dropbox for USERNAME"""
"""del USERNAME: resets the dropbox for USERNAME."""
dbutils.reset_dropbox(cmd)
do_reset = do_del

Expand All @@ -42,4 +55,4 @@ def do_add(self, cmd):

if __name__ == "__main__":
cmdo = DropboxSetupCmd()
cmdo.cmdloop()
cmdo.cmdloop()

0 comments on commit c05e855

Please sign in to comment.