Add a logout command
[mw] / src / mw / clicommands.py
index 4b62564cfbf03f7a504fe607a132cb2a6e772c78..33c4177d0ceac2ec134fbc46dc669879e6abf636 100644 (file)
@@ -98,6 +98,19 @@ class LoginCommand(CommandBase):
         self._login()
 
 
+class LogoutCommand(CommandBase):
+
+    def __init__(self):
+        CommandBase.__init__(self, 'logout', 'forget authentication')
+
+    def _do_command(self):
+        self._die_if_no_init()
+        try:
+            os.unlink(os.path.join(self.metadir.location, 'cookies'))
+        except OSError:
+            pass
+
+
 class PullCommand(CommandBase):
 
     def __init__(self):

Benjamin Mako Hill || Want to submit a patch?