Browse Source

autocomplete drop_request with multiple requests

master
Andrea Cimbalo 7 years ago
parent
commit
c2a5a7d226
1 changed files with 10 additions and 9 deletions
  1. +10
    -9
      shell.py

+ 10
- 9
shell.py View File

@ -220,23 +220,24 @@ class CAManagerShell(cmd.Cmd):
sign_request(self.ca_manager, request_id, authority_id)
def common_complete_request(self, text, line, begidx, endidx):
argc = len(("%send"%line).split())
if argc == 2:
return [request.req_id for i, request in enumerate(self.ca_manager.request) if request.req_id.startswith(text)]
def common_complete_request(self, text, line, begidx, endidx, check_argc=2):
argv = ("%send"%line).split()
argc = len(argv)
if check_argc == None or argc == check_argc:
return [request.req_id for i, request in enumerate(self.ca_manager.request) if request.req_id.startswith(text) and request.req_id not in argv[1:]]
def common_complete_ca(self, text, line, begidx, endidx):
def common_complete_ca(self, text, line, begidx, endidx, check_argc=2):
argc = len(("%send"%line).split())
if argc == 2:
if check_argc == None or argc == check_argc:
return [ca_item.ca_id for i, ca_item in enumerate(self.ca_manager.ca) if ca_item.ca_id.startswith(text)]
def common_complete_certificate(self, text, line, begidx, endidx):
def common_complete_certificate(self, text, line, begidx, endidx, check_argc=2):
argc = len(("%send"%line).split())
if argc == 2:
if check_argc == None or argc == check_argc:
return [certificate.cert_id for i, certificate in enumerate(self.ca_manager.certificate) if certificate.cert_id.startswith(text)]
def complete_drop_request(self, text, line, begidx, endidx):
return self.common_complete_request(text, line, begidx, endidx)
return self.common_complete_request(text, line, begidx, endidx, None)
def complete_describe_certificate(self, text, line, begidx, endidx):
return self.common_complete_certificate(text, line, begidx, endidx)


Loading…
Cancel
Save