mirror of
https://github.com/onyx-and-iris/q3rcon-cli.git
synced 2026-04-13 04:23:38 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 305af813b8 | |||
| 80638762d3 | |||
| 68f917286f | |||
| 3062cfa4d8 | |||
| 03597b580f |
11
README.md
11
README.md
@@ -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.
|
||||||
|
|||||||
@@ -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.0'
|
__version__ = '0.3.3'
|
||||||
|
|||||||
@@ -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,
|
||||||
@@ -116,6 +120,7 @@ class Q3rconCli(Command):
|
|||||||
console.err.print(
|
console.err.print(
|
||||||
f"Timeout waiting for response for command: '{command}'"
|
f"Timeout waiting for response for command: '{command}'"
|
||||||
)
|
)
|
||||||
|
|
||||||
console.out.print_response(response)
|
console.out.print_response(response)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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 = []
|
||||||
|
|||||||
Reference in New Issue
Block a user