# built-ins
from dataclasses import dataclass
from getpass import getuser
+from typing import Optional
# ourselves
from ircplom.tui_base import (BaseTui, PromptWidget, TuiEvent, Window,
CMD_SHORTCUTS)
host_port: str,
nickname_pw: str = '',
realname: str = ''
- ) -> None:
+ ) -> Optional[str]:
'Create Client and pass it via NewClientEvent.'
split = host_port.split(':', maxsplit=1)
hostname = split[0]
if hostname in [win.client_id for win in self._all_client_wins]:
- self._log.alert(f'already set up connection to {hostname}')
- return
+ return f'already set up connection to {hostname}'
port = -1
if len(split) > 1:
to_int = split[1]
if to_int.isdigit():
port = int(split[1])
else:
- self._log.alert(f'invalid port number: {to_int}')
- return
+ return f'invalid port number: {to_int}'
split = nickname_pw.split(':', maxsplit=1)
nickname = split[0] if nickname_pw else getuser()
password = split[1] if len(split) > 1 else ''
_q_out=self._q_out,
conn_setup=IrcConnSetup(
hostname, port, nickname, realname, password))))
+ return None
@dataclass
self.window.draw()
@property
- def _commands(self) -> dict[str, tuple[Callable[..., None],
+ def _commands(self) -> dict[str, tuple[Callable[..., None | Optional[str]],
int, tuple[str, ...]]]:
cmds = {}
method_name_prefix = 'cmd__'