Added list subcommand to dropbox_setup.py
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
+#! python2
+# StaSh utility
+
"""manage your dropbox configuration."""
+
import cmd
+import keychain
import sys
from stashutils import dbutils
@@ -21,8 +26,16 @@ class DropboxSetupCmd(cmd.Cmd):
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
