aboutsummaryrefslogtreecommitdiff
path: root/mm3mod/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'mm3mod/__init__.py')
-rw-r--r--mm3mod/__init__.py23
1 files changed, 5 insertions, 18 deletions
diff --git a/mm3mod/__init__.py b/mm3mod/__init__.py
index 92be097..3f22b6d 100644
--- a/mm3mod/__init__.py
+++ b/mm3mod/__init__.py
@@ -2,22 +2,19 @@
# Licensed under the LGPL v3 https://www.gnu.org/licenses/lgpl-3.0.html
import os
-import cmd
+import cmd2
import configparser
from pathlib import PurePath
from mailmanclient.client import Client
-class ModShell(cmd.Cmd):
+class ModShell(cmd2.Cmd):
intro = 'Type help or ? for a list of commands'
def __init__(self, client, mlist):
self.client = client;
self.mlist = mlist;
self.prompt = '({:s}) '.format(mlist.list_name)
- cmd.Cmd.__init__(self)
-
- def emptyline(self):
- pass
+ cmd2.Cmd.__init__(self)
def print_held(self):
self.held_messages = self.mlist.get_held_page (50,1)
@@ -32,7 +29,7 @@ class ModShell(cmd.Cmd):
for msg in self.held_messages:
string = str(msg.request_id)
- if text == string[0:prefix_len]:
+ if string.startswith(text):
candidates.append(string)
return candidates
@@ -55,7 +52,7 @@ class ModShell(cmd.Cmd):
def complete_discard(self, text, line, begidx, endidx):
candidates = self.matching_request_ids(text)
- if text == "page"[0:prefix_len]:
+ if "page".startswith(text):
candidates.append('page')
return candidates
@@ -85,16 +82,6 @@ class ModShell(cmd.Cmd):
self.print_held()
return stop
- def do_EOF(self,arg):
- 'exit'
- return True
-
- def do_quit(self,arg):
- '''
- exit moderation shell
- '''
- return True
-
def main ():
home = os.environ.get('HOME')