5 Commits

Author SHA1 Message Date
74393f5fb3 minor bump 2026-02-19 23:45:01 +00:00
316fa2bd5f write an error message to the user if a command fails. 2026-02-19 23:44:39 +00:00
e87ca1d0e5 upd dotenv file path 2026-02-19 23:36:42 +00:00
3fbac04756 add hatch and ruff badges 2026-02-19 22:43:13 +00:00
637597c95a add description 2026-02-19 22:34:37 +00:00
4 changed files with 19 additions and 10 deletions

View File

@@ -1,5 +1,7 @@
# q3rcon tui
[![Hatch project](https://img.shields.io/badge/%F0%9F%A5%9A-Hatch-4051b5.svg)](https://github.com/pypa/hatch)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![PyPI - Version](https://img.shields.io/pypi/v/q3rcon-tui.svg)](https://pypi.org/project/q3rcon-tui)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/q3rcon-tui.svg)](https://pypi.org/project/q3rcon-tui)
@@ -42,7 +44,7 @@ q3rcon-tui --host=localhost --port=28960 --password=rconpassword
Store and load from dotenv files located at:
- .env in the cwd
- user home directory / .config / rcon-tui / config.env
- user home directory / .config / q3rcon-tui / config.env
example .env:

View File

@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
[project]
name = "q3rcon-tui"
dynamic = ["version"]
description = ''
description = 'A terminal user interface for managing Q3 compatible servers using RCON.'
readme = "README.md"
requires-python = ">=3.10"
license = "MIT"

View File

@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2026-present onyx-and-iris <code@onyxandiris.online>
#
# SPDX-License-Identifier: MIT
__version__ = '0.1.0'
__version__ = '0.2.0'

View File

@@ -2,7 +2,7 @@ import re
from pathlib import Path
from typing import Annotated, Type
from aioq3rcon import Client
from aioq3rcon import Client, RCONError
from loguru import logger
from pydantic import AfterValidator, BeforeValidator
from pydantic_settings import BaseSettings, CliSettingsSource, SettingsConfigDict
@@ -36,7 +36,7 @@ class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_file=(
'.env',
Path.home() / '.config' / 'rcon-tui' / 'config.env',
Path.home() / '.config' / 'q3rcon-tui' / 'config.env',
),
env_file_encoding='utf-8',
env_prefix='Q3RCON_TUI_',
@@ -94,12 +94,19 @@ class RconApp(App):
if settings.refresh_output:
self.query_one('#response', RichLog).clear()
async with Client(settings.host, settings.port, settings.password) as client:
response = await client.send_command(
self.query_one('#command', Input).value
)
try:
async with Client(
settings.host, settings.port, settings.password
) as client:
response = await client.send_command(
self.query_one('#command', Input).value
)
self.query_one('#response', RichLog).write(
self.remove_color_codes(response.removeprefix('print\n'))
)
except RCONError as e:
self.query_one('#response', RichLog).write(
self.remove_color_codes(response.removeprefix('print\n'))
f'{type(e).__name__}: Unable to connect to server: is the server running and are the host, port, and password correct? ({e})'
)
self.query_one('#command', Input).value = ''