3 Commits

Author SHA1 Message Date
305af813b8 implement Connection flag parsing
add Shell Completion section to README

patch bump
2026-03-23 23:30:29 +00:00
80638762d3 patch bump 2026-03-23 20:45:41 +00:00
68f917286f move empty response test into {OutConsole}.print_response() 2026-03-23 20:45:28 +00:00
4 changed files with 19 additions and 6 deletions

View File

@@ -10,6 +10,9 @@
## Table of Contents ## Table of Contents
- [Installation](#installation) - [Installation](#installation)
- [Configuration](#configuration)
- [Use](#use)
- [Shell Completion](#shell-completion)
- [License](#license) - [License](#license)
## Installation ## Installation
@@ -83,6 +86,14 @@ Usage: q3rcon-cli [OPTIONS] COMMAND
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
``` ```
## Shell Completion
Shell completion scripts are available for *bash*, *zsh*, and *fish*.
```console
q3rcon-cli --install-autocomplete
```
## Special Thanks ## Special Thanks
- [lapetus-11](https://github.com/Iapetus-11) for writing the [aio-q3-rcon](https://github.com/Iapetus-11/aio-q3-rcon) package. - [lapetus-11](https://github.com/Iapetus-11) for writing the [aio-q3-rcon](https://github.com/Iapetus-11/aio-q3-rcon) package.

View File

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

View File

@@ -1,6 +1,7 @@
import clypi import clypi
from aioq3rcon import Client, IncorrectPasswordError from aioq3rcon import Client, IncorrectPasswordError
from clypi import Command, Spinner, arg from clypi import Command, Spinner, arg
from clypi import parsers as cp
from typing_extensions import override from typing_extensions import override
from . import console from . import console
@@ -38,6 +39,7 @@ class Q3rconCli(Command):
help='The host to connect to', help='The host to connect to',
env='Q3RCON_CLI_HOST', env='Q3RCON_CLI_HOST',
group='Connection', group='Connection',
parser=cp.Str(min=1),
) )
port: int = arg( port: int = arg(
28960, 28960,
@@ -45,6 +47,7 @@ class Q3rconCli(Command):
help='The port to connect to', help='The port to connect to',
env='Q3RCON_CLI_PORT', env='Q3RCON_CLI_PORT',
group='Connection', group='Connection',
parser=cp.Int(min=1, max=65535),
) )
password: str = arg( password: str = arg(
'', '',
@@ -52,6 +55,7 @@ class Q3rconCli(Command):
help='The password for authentication', help='The password for authentication',
env='Q3RCON_CLI_PASSWORD', env='Q3RCON_CLI_PASSWORD',
group='Connection', group='Connection',
parser=cp.Str(min=8),
) )
interactive: bool = arg( interactive: bool = arg(
False, False,
@@ -117,8 +121,7 @@ class Q3rconCli(Command):
f"Timeout waiting for response for command: '{command}'" f"Timeout waiting for response for command: '{command}'"
) )
if response: console.out.print_response(response)
console.out.print_response(response)
def main(): def main():

View File

@@ -50,9 +50,8 @@ class OutConsole(Console):
return OutConsole.COLOUR_CODE_REGEX.sub('', s) return OutConsole.COLOUR_CODE_REGEX.sub('', s)
def print_response(self, response: str): def print_response(self, response: str):
response = self._remove_colour_codes(response).removeprefix('print\n') if response := self._remove_colour_codes(response).removeprefix('print\n'):
cprint(response, fg=self.style)
cprint(response, fg=self.style)
def print_status(self, response: str): def print_status(self, response: str):
_slots = [] _slots = []