Skip to content

Commit

Permalink
Merge pull request #20 from Mr-Sunglasses/fix/19
Browse files Browse the repository at this point in the history
fix: Handle program kill errors correctly
  • Loading branch information
Mr-Sunglasses authored Sep 16, 2024
2 parents 5f74d8f + 92a83e3 commit 09dcdb4
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions src/bitssh/prompt.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,33 @@
from .utils import ConfigPathUtility
from .ui import console
import os

from inquirer import List
from typing import List, Dict
from typing import List, Dict, Optional


def ask_host_prompt():
HOST: list[str] = ConfigPathUtility.get_config_file_host_data()
questions: list[List] = [
HOST: List[str] = ConfigPathUtility.get_config_file_host_data()
questions: List[List] = [
inquirer.List(
name="host",
message="Select the Host Given in the Above List",
choices=HOST,
),
]
try:
answers: Optional[Dict[str, str]] = inquirer.prompt(
questions=questions, theme=GreenPassion()
)
if answers is None:
return

answers: Dict[str, str] = inquirer.prompt(questions=questions, theme=GreenPassion())

cmd: str = answers["host"]
cmd: str = cmd[6::]
cmd: str = f"ssh {cmd}"
console.print(
"Please Wait While Your System is Connecting to the Remote Server 🖥️",
style="green",
)
os.system(cmd)
cmd: str = answers["host"]
cmd = cmd[6:]
cmd = f"ssh {cmd}"
console.print(
"Please Wait While Your System is Connecting to the Remote Server 🖥️",
style="green",
)
os.system(cmd)
except Exception as Error:
print(f"\nInterrupted by {Error}")

0 comments on commit 09dcdb4

Please sign in to comment.