mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-20 07:24:41 +02:00
DRYer: Get hostname
This commit is contained in:
@@ -595,6 +595,14 @@ def natsort_ints(iterable: Iterable[str]) -> List[str]:
|
||||
return sorted(iterable, key=alphanum_key)
|
||||
|
||||
|
||||
def get_hostname(fallback: str = '') -> str:
|
||||
import socket
|
||||
try:
|
||||
return socket.gethostname() or fallback
|
||||
except Exception:
|
||||
return fallback
|
||||
|
||||
|
||||
def resolve_editor_cmd(editor: str, shell_env: Mapping[str, str]) -> Optional[str]:
|
||||
import shlex
|
||||
editor_cmd = shlex.split(editor)
|
||||
|
||||
Reference in New Issue
Block a user