Split disconnect and exit commands
This commit is contained in:
11
lslsh.py
11
lslsh.py
@@ -67,6 +67,13 @@ class Shell(cmd.Cmd):
|
||||
def do_exit(self, arg):
|
||||
"""Exit the shell."""
|
||||
print("")
|
||||
if self.url:
|
||||
self.do_disconnect(None)
|
||||
|
||||
return True
|
||||
|
||||
def do_disconnect(self, arg):
|
||||
"""Disconnect from remote."""
|
||||
if self.url:
|
||||
result = self.send_cmd(self.url, "disconnect")
|
||||
if result.get("result") == "disconnected":
|
||||
@@ -74,7 +81,9 @@ class Shell(cmd.Cmd):
|
||||
else:
|
||||
print("Disconnected from remote (without acknowledgement).")
|
||||
|
||||
return True
|
||||
url = None
|
||||
else:
|
||||
print("Error: Not connected to remote.")
|
||||
|
||||
def add_cmd(self, name, help_text):
|
||||
"""Make a new command available within the shell."""
|
||||
|
||||
Reference in New Issue
Block a user