]> projects.mako.cc - mw/commitdiff
Add a logout command
authorIan Weller <ian@ianweller.org>
Sun, 14 Mar 2010 07:49:04 +0000 (01:49 -0600)
committerIan Weller <ian@ianweller.org>
Sun, 14 Mar 2010 07:49:04 +0000 (01:49 -0600)
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?