q3rcon-cli 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,39 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ push:
7
+ tags:
8
+ - 'v*.*.*'
9
+
10
+ jobs:
11
+ deploy:
12
+ runs-on: ubuntu-latest
13
+
14
+ environment: pypi
15
+ permissions:
16
+ # This permission is needed for private repositories.
17
+ contents: read
18
+ # IMPORTANT: this permission is mandatory for trusted publishing
19
+ id-token: write
20
+
21
+ steps:
22
+ - uses: actions/checkout@v6
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v6
26
+ with:
27
+ python-version: '3.11'
28
+ cache: 'pip'
29
+
30
+ - name: Install dependencies
31
+ run: |
32
+ python -m pip install --upgrade pip
33
+ pip install hatch
34
+
35
+ - name: Build package
36
+ run: hatch build
37
+
38
+ - name: Publish on PyPI
39
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,19 @@
1
+ name: Ruff
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+
7
+ pull_request:
8
+ branches: [main]
9
+
10
+ workflow_dispatch:
11
+
12
+ jobs:
13
+ ruff:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v6
17
+ - uses: astral-sh/ruff-action@v3
18
+ with:
19
+ args: 'format --check --diff'
@@ -0,0 +1,212 @@
1
+ # Generated by ignr: github.com/onyx-and-iris/ignr
2
+
3
+ ## Python ##
4
+ # Byte-compiled / optimized / DLL files
5
+ __pycache__/
6
+ *.py[codz]
7
+ *$py.class
8
+
9
+ # C extensions
10
+ *.so
11
+
12
+ # Distribution / packaging
13
+ .Python
14
+ build/
15
+ develop-eggs/
16
+ dist/
17
+ downloads/
18
+ eggs/
19
+ .eggs/
20
+ lib/
21
+ lib64/
22
+ parts/
23
+ sdist/
24
+ var/
25
+ wheels/
26
+ share/python-wheels/
27
+ *.egg-info/
28
+ .installed.cfg
29
+ *.egg
30
+ MANIFEST
31
+
32
+ # PyInstaller
33
+ # Usually these files are written by a python script from a template
34
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
35
+ *.manifest
36
+ *.spec
37
+
38
+ # Installer logs
39
+ pip-log.txt
40
+ pip-delete-this-directory.txt
41
+
42
+ # Unit test / coverage reports
43
+ htmlcov/
44
+ .tox/
45
+ .nox/
46
+ .coverage
47
+ .coverage.*
48
+ .cache
49
+ nosetests.xml
50
+ coverage.xml
51
+ *.cover
52
+ *.py.cover
53
+ .hypothesis/
54
+ .pytest_cache/
55
+ cover/
56
+
57
+ # Translations
58
+ *.mo
59
+ *.pot
60
+
61
+ # Django stuff:
62
+ *.log
63
+ local_settings.py
64
+ db.sqlite3
65
+ db.sqlite3-journal
66
+
67
+ # Flask stuff:
68
+ instance/
69
+ .webassets-cache
70
+
71
+ # Scrapy stuff:
72
+ .scrapy
73
+
74
+ # Sphinx documentation
75
+ docs/_build/
76
+
77
+ # PyBuilder
78
+ .pybuilder/
79
+ target/
80
+
81
+ # Jupyter Notebook
82
+ .ipynb_checkpoints
83
+
84
+ # IPython
85
+ profile_default/
86
+ ipython_config.py
87
+
88
+ # pyenv
89
+ # For a library or package, you might want to ignore these files since the code is
90
+ # intended to run in multiple environments; otherwise, check them in:
91
+ # .python-version
92
+
93
+ # pipenv
94
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
95
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
96
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
97
+ # install all needed dependencies.
98
+ #Pipfile.lock
99
+
100
+ # UV
101
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
102
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
103
+ # commonly ignored for libraries.
104
+ #uv.lock
105
+
106
+ # poetry
107
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
108
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
109
+ # commonly ignored for libraries.
110
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
111
+ #poetry.lock
112
+ #poetry.toml
113
+
114
+ # pdm
115
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
116
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
117
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
118
+ #pdm.lock
119
+ #pdm.toml
120
+ .pdm-python
121
+ .pdm-build/
122
+
123
+ # pixi
124
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
125
+ #pixi.lock
126
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
127
+ # in the .venv directory. It is recommended not to include this directory in version control.
128
+ .pixi
129
+
130
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
131
+ __pypackages__/
132
+
133
+ # Celery stuff
134
+ celerybeat-schedule
135
+ celerybeat.pid
136
+
137
+ # SageMath parsed files
138
+ *.sage.py
139
+
140
+ # Environments
141
+ .env
142
+ .envrc
143
+ .venv
144
+ env/
145
+ venv/
146
+ ENV/
147
+ env.bak/
148
+ venv.bak/
149
+
150
+ # Spyder project settings
151
+ .spyderproject
152
+ .spyproject
153
+
154
+ # Rope project settings
155
+ .ropeproject
156
+
157
+ # mkdocs documentation
158
+ /site
159
+
160
+ # mypy
161
+ .mypy_cache/
162
+ .dmypy.json
163
+ dmypy.json
164
+
165
+ # Pyre type checker
166
+ .pyre/
167
+
168
+ # pytype static type analyzer
169
+ .pytype/
170
+
171
+ # Cython debug symbols
172
+ cython_debug/
173
+
174
+ # PyCharm
175
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
176
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
177
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
178
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
179
+ #.idea/
180
+
181
+ # Abstra
182
+ # Abstra is an AI-powered process automation framework.
183
+ # Ignore directories containing user credentials, local state, and settings.
184
+ # Learn more at https://abstra.io/docs
185
+ .abstra/
186
+
187
+ # Visual Studio Code
188
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
189
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
190
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
191
+ # you could uncomment the following to ignore the entire vscode folder
192
+ # .vscode/
193
+
194
+ # Ruff stuff:
195
+ .ruff_cache/
196
+
197
+ # PyPI configuration file
198
+ .pypirc
199
+
200
+ # Cursor
201
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
202
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
203
+ # refer to https://docs.cursor.com/context/ignore-files
204
+ .cursorignore
205
+ .cursorindexingignore
206
+
207
+ # Marimo
208
+ marimo/_static/
209
+ marimo/_lsp/
210
+ __marimo__/
211
+
212
+ # End of ignr
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present onyx-and-iris <code@onyxandiris.online>
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,113 @@
1
+ Metadata-Version: 2.4
2
+ Name: q3rcon-cli
3
+ Version: 0.1.0
4
+ Summary: An async CLI for Q3 compatible RCON servers built with aio-q3-rcon and clypi.
5
+ Project-URL: Documentation, https://github.com/onyx-and-iris/q3rcon-cli#readme
6
+ Project-URL: Issues, https://github.com/onyx-and-iris/q3rcon-cli/issues
7
+ Project-URL: Source, https://github.com/onyx-and-iris/q3rcon-cli
8
+ Author-email: onyx-and-iris <code@onyxandiris.online>
9
+ License-Expression: MIT
10
+ License-File: LICENSE.txt
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: Implementation :: CPython
17
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: aio-q3-rcon>=1.0.0
20
+ Requires-Dist: clypi>=1.8.2
21
+ Description-Content-Type: text/markdown
22
+
23
+ # q3rcon-cli
24
+
25
+ [![Hatch project](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pypa/hatch/master/docs/assets/badge/v0.json)](https://github.com/pypa/hatch)
26
+ [![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)
27
+ [![PyPI - Version](https://img.shields.io/pypi/v/q3rcon-cli.svg)](https://pypi.org/project/q3rcon-cli)
28
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/q3rcon-cli.svg)](https://pypi.org/project/q3rcon-cli)
29
+
30
+ -----
31
+
32
+ ## Table of Contents
33
+
34
+ - [Installation](#installation)
35
+ - [License](#license)
36
+
37
+ ## Installation
38
+
39
+ *with uv*
40
+
41
+ ```console
42
+ uv tool install q3rcon-cli
43
+ ```
44
+
45
+ *with pipx*
46
+
47
+ ```console
48
+ pipx install q3rcon-cli
49
+ ```
50
+
51
+ The CLI should now be discoverable as q3rcon-cli.
52
+
53
+ ## Configuration
54
+
55
+ #### Flags
56
+
57
+ Pass `--host`, `--port` and `--password` as flags:
58
+
59
+ ```console
60
+ q3rcon-cli --host=localhost --port=28960 --password=rconpassword
61
+ ```
62
+
63
+ Additional Flags:
64
+
65
+ - `--interactive`: Boolean flag, enable REPL mode.
66
+
67
+ #### Environment Variables
68
+
69
+ example .envrc:
70
+
71
+ ```env
72
+ #!/usr/bin/env bash
73
+
74
+ export Q3RCON_CLI_HOST="localhost"
75
+ export Q3RCON_CLI_PORT="28960"
76
+ export Q3RCON_CLI_PASSWORD="<rcon password>"
77
+ ```
78
+
79
+ ## Use
80
+
81
+ ```console
82
+ Usage: q3rcon-cli [OPTIONS] COMMAND
83
+
84
+ ┏━ Subcommands ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
85
+ ┃ status Prints the status of the server ┃
86
+ ┃ mapname Prints the current map name of the server ┃
87
+ ┃ maprotate Rotates the map to the next one in the map rotation list ┃
88
+ ┃ fastrestart Executes a fast restart of the server ┃
89
+ ┃ gametype Get or set the current gametype of the server ┃
90
+ ┃ hostname Get or set the current hostname of the server ┃
91
+ ┃ map Get the current map or change to a new one ┃
92
+ ┃ plugins Prints the currently loaded plugins of the server ┃
93
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
94
+
95
+ ┏━ Options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
96
+ ┃ -i, --interactive Whether to start in interactive mode (defaults to false) ┃
97
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
98
+
99
+ ┏━ Connection options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
100
+ ┃ -h, --host <HOST> The host to connect to ┃
101
+ ┃ -p, --port <PORT> The port to connect to ┃
102
+ ┃ -P, --password <PASSWORD> The password for authentication ┃
103
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
104
+ ```
105
+
106
+ ## Special Thanks
107
+
108
+ - [lapetus-11](https://github.com/Iapetus-11) for writing the [aio-q3-rcon](https://github.com/Iapetus-11/aio-q3-rcon) package.
109
+ - [Daniel Melchor](https://github.com/danimelchor) for creating the wonderful [clypi](https://github.com/danimelchor/clypi) library.
110
+
111
+ ## License
112
+
113
+ `q3rcon-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
@@ -0,0 +1,91 @@
1
+ # q3rcon-cli
2
+
3
+ [![Hatch project](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/pypa/hatch/master/docs/assets/badge/v0.json)](https://github.com/pypa/hatch)
4
+ [![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)
5
+ [![PyPI - Version](https://img.shields.io/pypi/v/q3rcon-cli.svg)](https://pypi.org/project/q3rcon-cli)
6
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/q3rcon-cli.svg)](https://pypi.org/project/q3rcon-cli)
7
+
8
+ -----
9
+
10
+ ## Table of Contents
11
+
12
+ - [Installation](#installation)
13
+ - [License](#license)
14
+
15
+ ## Installation
16
+
17
+ *with uv*
18
+
19
+ ```console
20
+ uv tool install q3rcon-cli
21
+ ```
22
+
23
+ *with pipx*
24
+
25
+ ```console
26
+ pipx install q3rcon-cli
27
+ ```
28
+
29
+ The CLI should now be discoverable as q3rcon-cli.
30
+
31
+ ## Configuration
32
+
33
+ #### Flags
34
+
35
+ Pass `--host`, `--port` and `--password` as flags:
36
+
37
+ ```console
38
+ q3rcon-cli --host=localhost --port=28960 --password=rconpassword
39
+ ```
40
+
41
+ Additional Flags:
42
+
43
+ - `--interactive`: Boolean flag, enable REPL mode.
44
+
45
+ #### Environment Variables
46
+
47
+ example .envrc:
48
+
49
+ ```env
50
+ #!/usr/bin/env bash
51
+
52
+ export Q3RCON_CLI_HOST="localhost"
53
+ export Q3RCON_CLI_PORT="28960"
54
+ export Q3RCON_CLI_PASSWORD="<rcon password>"
55
+ ```
56
+
57
+ ## Use
58
+
59
+ ```console
60
+ Usage: q3rcon-cli [OPTIONS] COMMAND
61
+
62
+ ┏━ Subcommands ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
63
+ ┃ status Prints the status of the server ┃
64
+ ┃ mapname Prints the current map name of the server ┃
65
+ ┃ maprotate Rotates the map to the next one in the map rotation list ┃
66
+ ┃ fastrestart Executes a fast restart of the server ┃
67
+ ┃ gametype Get or set the current gametype of the server ┃
68
+ ┃ hostname Get or set the current hostname of the server ┃
69
+ ┃ map Get the current map or change to a new one ┃
70
+ ┃ plugins Prints the currently loaded plugins of the server ┃
71
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
72
+
73
+ ┏━ Options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
74
+ ┃ -i, --interactive Whether to start in interactive mode (defaults to false) ┃
75
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
76
+
77
+ ┏━ Connection options ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
78
+ ┃ -h, --host <HOST> The host to connect to ┃
79
+ ┃ -p, --port <PORT> The port to connect to ┃
80
+ ┃ -P, --password <PASSWORD> The password for authentication ┃
81
+ ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
82
+ ```
83
+
84
+ ## Special Thanks
85
+
86
+ - [lapetus-11](https://github.com/Iapetus-11) for writing the [aio-q3-rcon](https://github.com/Iapetus-11/aio-q3-rcon) package.
87
+ - [Daniel Melchor](https://github.com/danimelchor) for creating the wonderful [clypi](https://github.com/danimelchor/clypi) library.
88
+
89
+ ## License
90
+
91
+ `q3rcon-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
@@ -0,0 +1,52 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "q3rcon-cli"
7
+ dynamic = ["version"]
8
+ description = 'An async CLI for Q3 compatible RCON servers built with aio-q3-rcon and clypi.'
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "MIT"
12
+ keywords = []
13
+ authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Programming Language :: Python",
17
+ "Programming Language :: Python :: 3.10",
18
+ "Programming Language :: Python :: 3.11",
19
+ "Programming Language :: Python :: 3.12",
20
+ "Programming Language :: Python :: Implementation :: CPython",
21
+ "Programming Language :: Python :: Implementation :: PyPy",
22
+ ]
23
+ dependencies = ["aio-q3-rcon>=1.0.0", "clypi>=1.8.2"]
24
+
25
+ [project.scripts]
26
+ q3rcon-cli = "q3rcon_cli.cli:main"
27
+
28
+ [project.urls]
29
+ Documentation = "https://github.com/onyx-and-iris/q3rcon-cli#readme"
30
+ Issues = "https://github.com/onyx-and-iris/q3rcon-cli/issues"
31
+ Source = "https://github.com/onyx-and-iris/q3rcon-cli"
32
+
33
+ [tool.hatch.version]
34
+ path = "src/q3rcon_cli/__about__.py"
35
+
36
+ [tool.hatch.envs.types]
37
+ extra-dependencies = ["mypy>=1.0.0"]
38
+ [tool.hatch.envs.types.scripts]
39
+ check = "mypy --install-types --non-interactive {args:src/q3rcon_cli tests}"
40
+
41
+ [tool.coverage.run]
42
+ source_pkgs = ["q3rcon_cli", "tests"]
43
+ branch = true
44
+ parallel = true
45
+ omit = ["src/q3rcon_cli/__about__.py"]
46
+
47
+ [tool.coverage.paths]
48
+ q3rcon_cli = ["src/q3rcon_cli", "*/q3rcon-cli/src/q3rcon_cli"]
49
+ tests = ["tests", "*/q3rcon-cli/tests"]
50
+
51
+ [tool.coverage.report]
52
+ exclude_lines = ["no cov", "if __name__ == .__main__.:", "if TYPE_CHECKING:"]
@@ -0,0 +1,77 @@
1
+ # Exclude a variety of commonly ignored directories.
2
+ exclude = [
3
+ ".bzr",
4
+ ".direnv",
5
+ ".eggs",
6
+ ".git",
7
+ ".git-rewrite",
8
+ ".hg",
9
+ ".ipynb_checkpoints",
10
+ ".mypy_cache",
11
+ ".nox",
12
+ ".pants.d",
13
+ ".pyenv",
14
+ ".pytest_cache",
15
+ ".pytype",
16
+ ".ruff_cache",
17
+ ".svn",
18
+ ".tox",
19
+ ".venv",
20
+ ".vscode",
21
+ "__pypackages__",
22
+ "_build",
23
+ "buck-out",
24
+ "build",
25
+ "dist",
26
+ "node_modules",
27
+ "site-packages",
28
+ "venv",
29
+ ]
30
+
31
+ # Same as Black.
32
+ line-length = 88
33
+ indent-width = 4
34
+
35
+ # Assume Python 3.10
36
+ target-version = "py310"
37
+
38
+ [lint]
39
+ # Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
40
+ # Unlike Flake8, Ruff doesn't enable pycodestyle warnings (`W`) or
41
+ # McCabe complexity (`C901`) by default.
42
+ select = ["E4", "E7", "E9", "F"]
43
+ ignore = []
44
+
45
+ # Allow fix for all enabled rules (when `--fix`) is provided.
46
+ fixable = ["ALL"]
47
+ unfixable = []
48
+
49
+ # Allow unused variables when underscore-prefixed.
50
+ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
51
+
52
+ [format]
53
+ # Unlike Black, use single quotes for strings.
54
+ quote-style = "single"
55
+
56
+ # Like Black, indent with spaces, rather than tabs.
57
+ indent-style = "space"
58
+
59
+ # Like Black, respect magic trailing commas.
60
+ skip-magic-trailing-comma = false
61
+
62
+ # Like Black, automatically detect the appropriate line ending.
63
+ line-ending = "auto"
64
+
65
+ # Enable auto-formatting of code examples in docstrings. Markdown,
66
+ # reStructuredText code/literal blocks and doctests are all supported.
67
+ #
68
+ # This is currently disabled by default, but it is planned for this
69
+ # to be opt-out in the future.
70
+ docstring-code-format = false
71
+
72
+ # Set the line length limit used when formatting code snippets in
73
+ # docstrings.
74
+ #
75
+ # This only has an effect when the `docstring-code-format` setting is
76
+ # enabled.
77
+ docstring-code-line-length = "dynamic"
@@ -0,0 +1,4 @@
1
+ # SPDX-FileCopyrightText: 2026-present onyx-and-iris <code@onyxandiris.online>
2
+ #
3
+ # SPDX-License-Identifier: MIT
4
+ __version__ = "0.1.0"
@@ -0,0 +1,3 @@
1
+ # SPDX-FileCopyrightText: 2026-present onyx-and-iris <code@onyxandiris.online>
2
+ #
3
+ # SPDX-License-Identifier: MIT
@@ -0,0 +1,102 @@
1
+ import clypi
2
+ from aioq3rcon import Client
3
+ from clypi import Command, arg
4
+ from typing_extensions import override
5
+
6
+ from .commands import (
7
+ Fastrestart,
8
+ Gametype,
9
+ Hostname,
10
+ Map,
11
+ Mapname,
12
+ Maprotate,
13
+ Plugins,
14
+ Status,
15
+ )
16
+ from .console import Console
17
+
18
+ Subcommands = (
19
+ Status | Mapname | Maprotate | Fastrestart | Gametype | Hostname | Map | Plugins
20
+ )
21
+
22
+
23
+ class Q3rconCli(Command):
24
+ subcommand: Subcommands | None = None
25
+ host: str = arg(
26
+ 'localhost',
27
+ short='h',
28
+ help='The host to connect to',
29
+ env='Q3RCON_CLI_HOST',
30
+ group='Connection',
31
+ )
32
+ port: int = arg(
33
+ 28960,
34
+ short='p',
35
+ help='The port to connect to',
36
+ env='Q3RCON_CLI_PORT',
37
+ group='Connection',
38
+ )
39
+ password: str = arg(
40
+ '',
41
+ short='P',
42
+ help='The password for authentication',
43
+ env='Q3RCON_CLI_PASSWORD',
44
+ group='Connection',
45
+ )
46
+ interactive: bool = arg(
47
+ False,
48
+ short='i',
49
+ help='Whether to start in interactive mode (defaults to false)',
50
+ )
51
+
52
+ @override
53
+ async def run(self):
54
+ if self.interactive:
55
+ await self.run_interactive()
56
+ else:
57
+ await Status.run(self)
58
+
59
+ async def run_interactive(self):
60
+ print(
61
+ clypi.style('Entering interactive mode. Type', fg='blue'),
62
+ clypi.style("'Q'", fg='red'),
63
+ clypi.style('to quit.', fg='blue'),
64
+ )
65
+
66
+ DEFAULT_FRAGMENT_READ_TIMEOUT = 0.25
67
+ while command := input(clypi.style('cmd: ', fg='green')):
68
+ if command.lower() == 'q':
69
+ break
70
+
71
+ fragment_read_timeout = None
72
+ if command in (
73
+ 'status',
74
+ 'fast_restart',
75
+ 'map_restart',
76
+ 'map',
77
+ 'map_rotate',
78
+ ):
79
+ fragment_read_timeout = 1
80
+
81
+ async with Client(
82
+ self.host,
83
+ self.port,
84
+ self.password,
85
+ fragment_read_timeout=fragment_read_timeout
86
+ or DEFAULT_FRAGMENT_READ_TIMEOUT,
87
+ ) as client:
88
+ try:
89
+ if response := await client.send_command(command):
90
+ Console.print_response(response)
91
+ except TimeoutError:
92
+ print(
93
+ clypi.style(
94
+ 'Timeout waiting for response for command:', fg='red'
95
+ ),
96
+ clypi.style(command, fg='yellow'),
97
+ )
98
+
99
+
100
+ def main():
101
+ cli = Q3rconCli().parse()
102
+ cli.start()
@@ -0,0 +1,19 @@
1
+ from .fastrestart import Fastrestart
2
+ from .gametype import Gametype
3
+ from .hostname import Hostname
4
+ from .map import Map
5
+ from .mapname import Mapname
6
+ from .maprotate import Maprotate
7
+ from .plugins import Plugins
8
+ from .status import Status
9
+
10
+ __all__ = [
11
+ 'Status',
12
+ 'Mapname',
13
+ 'Maprotate',
14
+ 'Fastrestart',
15
+ 'Gametype',
16
+ 'Hostname',
17
+ 'Map',
18
+ 'Plugins',
19
+ ]
@@ -0,0 +1,19 @@
1
+ from aioq3rcon import Client
2
+ from clypi import Command, arg
3
+ from typing_extensions import override
4
+
5
+ from q3rcon_cli.console import Console
6
+
7
+
8
+ class Fastrestart(Command):
9
+ """Executes a fast restart of the server."""
10
+
11
+ host: str = arg(inherited=True)
12
+ port: int = arg(inherited=True)
13
+ password: str = arg(inherited=True)
14
+
15
+ @override
16
+ async def run(self):
17
+ async with Client(self.host, self.port, self.password) as client:
18
+ if response := await client.send_command('fast_restart'):
19
+ Console.print_response(response)
@@ -0,0 +1,43 @@
1
+ from aioq3rcon import Client
2
+ from clypi import Command, Positional, Spinner, arg
3
+ from typing_extensions import override
4
+
5
+ from q3rcon_cli.console import Console
6
+
7
+
8
+ class Gametype(Command):
9
+ """Get or set the current gametype of the server."""
10
+
11
+ new_gametype: Positional[str] = arg(
12
+ help='The new gametype to change to (optional). If not provided, the current gametype will be printed.',
13
+ default='',
14
+ )
15
+ host: str = arg(inherited=True)
16
+ port: int = arg(inherited=True)
17
+ password: str = arg(inherited=True)
18
+ force: bool = arg(
19
+ False,
20
+ short='f',
21
+ help='Whether to force the gametype change even if players are currently in the server.',
22
+ )
23
+
24
+ @override
25
+ async def run(self):
26
+ if not Gametype.new_gametype:
27
+ async with Client(self.host, self.port, self.password) as client:
28
+ if response := await client.send_command('g_gametype'):
29
+ Console.print_cvar(response)
30
+ return
31
+
32
+ async with Client(self.host, self.port, self.password) as client:
33
+ DEFAULT_FRAGMENT_READ_TIMEOUT = client.fragment_read_timeout
34
+
35
+ await client.send_command(f'g_gametype {self.new_gametype}')
36
+ if self.force:
37
+ async with Spinner('Forcing gametype change...'):
38
+ client.fragment_read_timeout = 1
39
+ await client.send_command('map_restart')
40
+
41
+ client.fragment_read_timeout = DEFAULT_FRAGMENT_READ_TIMEOUT
42
+ if response := await client.send_command('g_gametype'):
43
+ Console.print_cvar(response)
@@ -0,0 +1,30 @@
1
+ from aioq3rcon import Client
2
+ from clypi import Command, Positional, arg
3
+ from typing_extensions import override
4
+
5
+ from q3rcon_cli.console import Console
6
+
7
+
8
+ class Hostname(Command):
9
+ """Get or set the current hostname of the server."""
10
+
11
+ new_hostname: Positional[str] = arg(
12
+ help='The new hostname to change to (optional). If not provided, the current hostname will be printed.',
13
+ default='',
14
+ )
15
+ host: str = arg(inherited=True)
16
+ port: int = arg(inherited=True)
17
+ password: str = arg(inherited=True)
18
+
19
+ @override
20
+ async def run(self):
21
+ if not self.new_hostname:
22
+ async with Client(self.host, self.port, self.password) as client:
23
+ if response := await client.send_command('sv_hostname'):
24
+ Console.print_cvar(response)
25
+ return
26
+
27
+ async with Client(self.host, self.port, self.password) as client:
28
+ await client.send_command(f'sv_hostname {self.new_hostname}')
29
+ if response := await client.send_command('sv_hostname'):
30
+ Console.print_cvar(response)
@@ -0,0 +1,33 @@
1
+ from aioq3rcon import Client
2
+ from clypi import Command, Positional, Spinner, arg
3
+ from typing_extensions import override
4
+
5
+ from q3rcon_cli.console import Console
6
+
7
+
8
+ class Map(Command):
9
+ """Get the current map or change to a new one."""
10
+
11
+ new_map: Positional[str] = arg(
12
+ help='The new map to change to (optional). If not provided, the current map will be printed.',
13
+ default='',
14
+ )
15
+ host: str = arg(inherited=True)
16
+ port: int = arg(inherited=True)
17
+ password: str = arg(inherited=True)
18
+
19
+ @override
20
+ async def run(self):
21
+ if not self.new_map:
22
+ async with Client(self.host, self.port, self.password) as client:
23
+ if response := await client.send_command('mapname'):
24
+ Console.print_cvar(response)
25
+ return
26
+
27
+ async with Spinner('Changing map...'):
28
+ async with Client(
29
+ self.host, self.port, self.password, fragment_read_timeout=1
30
+ ) as client:
31
+ await client.send_command(f'map mp_{self.new_map.removeprefix("mp_")}')
32
+ if response := await client.send_command('mapname'):
33
+ Console.print_cvar(response)
@@ -0,0 +1,19 @@
1
+ from aioq3rcon import Client
2
+ from clypi import Command, arg
3
+ from typing_extensions import override
4
+
5
+ from q3rcon_cli.console import Console
6
+
7
+
8
+ class Mapname(Command):
9
+ """Prints the current map name of the server."""
10
+
11
+ host: str = arg(inherited=True)
12
+ port: int = arg(inherited=True)
13
+ password: str = arg(inherited=True)
14
+
15
+ @override
16
+ async def run(self):
17
+ async with Client(self.host, self.port, self.password) as client:
18
+ if response := await client.send_command('mapname'):
19
+ Console.print_cvar(response)
@@ -0,0 +1,22 @@
1
+ from aioq3rcon import Client
2
+ from clypi import Command, Spinner, arg
3
+ from typing_extensions import override
4
+
5
+ from q3rcon_cli.console import Console
6
+
7
+
8
+ class Maprotate(Command):
9
+ """Rotates the map to the next one in the map rotation list."""
10
+
11
+ host: str = arg(inherited=True)
12
+ port: int = arg(inherited=True)
13
+ password: str = arg(inherited=True)
14
+
15
+ @override
16
+ async def run(self):
17
+ async with Spinner('Rotating map...'):
18
+ async with Client(
19
+ self.host, self.port, self.password, fragment_read_timeout=1
20
+ ) as client:
21
+ if response := await client.send_command('map_rotate'):
22
+ Console.print_response(response)
@@ -0,0 +1,19 @@
1
+ from aioq3rcon import Client
2
+ from clypi import Command, arg
3
+ from typing_extensions import override
4
+
5
+ from q3rcon_cli.console import Console
6
+
7
+
8
+ class Plugins(Command):
9
+ """Prints the currently loaded plugins of the server."""
10
+
11
+ host: str = arg(inherited=True)
12
+ port: int = arg(inherited=True)
13
+ password: str = arg(inherited=True)
14
+
15
+ @override
16
+ async def run(self):
17
+ async with Client(self.host, self.port, self.password) as client:
18
+ if response := await client.send_command('plugins'):
19
+ Console.print_response(response)
@@ -0,0 +1,22 @@
1
+ from aioq3rcon import Client
2
+ from clypi import Command, Spinner, arg
3
+ from typing_extensions import override
4
+
5
+ from q3rcon_cli.console import Console
6
+
7
+
8
+ class Status(Command):
9
+ """Prints the status of the server."""
10
+
11
+ host: str = arg(inherited=True)
12
+ port: int = arg(inherited=True)
13
+ password: str = arg(inherited=True)
14
+
15
+ @override
16
+ async def run(self):
17
+ async with Spinner('Fetching status...'):
18
+ async with Client(
19
+ self.host, self.port, self.password, fragment_read_timeout=0.5
20
+ ) as client:
21
+ if response := await client.send_command('status'):
22
+ Console.print_status(response)
@@ -0,0 +1,95 @@
1
+ import re
2
+
3
+ import clypi
4
+ from clypi import cprint
5
+
6
+
7
+ class Console:
8
+ COLOUR_CODE_REGEX = re.compile(r'\^[0-9]')
9
+ STATUS_PLAYER_REGEX = re.compile(
10
+ r'^\s*(?P<slot>[0-9]+)\s+'
11
+ r'(?P<score>[0-9-]+)\s+'
12
+ r'(?P<ping>[0-9]+)\s+'
13
+ r'(?P<guid>[0-9a-f]+)\s+'
14
+ r'(?P<name>.*?)\s+'
15
+ r'(?P<last>[0-9]+?)\s*'
16
+ r'(?P<ip>(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\.){3}'
17
+ r'(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])):?'
18
+ r'(?P<port>-?[0-9]{1,5})\s*'
19
+ r'(?P<qport>-?[0-9]{1,5})\s+'
20
+ r'(?P<rate>[0-9]+)$',
21
+ re.IGNORECASE | re.VERBOSE,
22
+ )
23
+ CVAR_REGEX = re.compile(
24
+ r'^["](?P<name>[a-z_]+)["]\sis[:]\s'
25
+ r'["](?P<value>.*?)["]\s'
26
+ r'default[:]\s'
27
+ r'["](?P<default>.*?)["]\s'
28
+ r'info[:]\s'
29
+ r'["](?P<info>.*?)["]$'
30
+ )
31
+
32
+ @staticmethod
33
+ def remove_colour_codes(s: str) -> str:
34
+ """Remove Quake 3 colour codes from a string."""
35
+ return Console.COLOUR_CODE_REGEX.sub('', s)
36
+
37
+ @staticmethod
38
+ def print_response(response: str):
39
+ response = Console.remove_colour_codes(response).removeprefix('print\n')
40
+
41
+ cprint(f'\n{response}\n', fg='yellow')
42
+
43
+ @staticmethod
44
+ def print_status(response: str):
45
+ _slots = []
46
+ _scores = []
47
+ _pings = []
48
+ _guids = []
49
+ _names = []
50
+ _ips = []
51
+
52
+ lines = response.splitlines()
53
+ for line in lines:
54
+ if m := Console.STATUS_PLAYER_REGEX.match(line):
55
+ _slots.append(m.group('slot'))
56
+ _scores.append(m.group('score'))
57
+ _pings.append(m.group('ping'))
58
+ _guids.append(m.group('guid'))
59
+ _names.append(m.group('name'))
60
+ _ips.append(m.group('ip'))
61
+
62
+ if not _slots:
63
+ cprint('\nNo players connected.\n', fg='yellow')
64
+ return
65
+
66
+ slots = clypi.boxed(_slots, title='Slot', width=15)
67
+ scores = clypi.boxed(_scores, title='Score', width=15)
68
+ pings = clypi.boxed(_pings, title='Ping', width=15)
69
+ guids = clypi.boxed(_guids, title='GUID', width=40)
70
+ names = clypi.boxed(_names, title='Name', width=30)
71
+ ips = clypi.boxed(_ips, title='IP', width=30)
72
+ print(f'\n{clypi.stack(slots, scores, pings, guids, names, ips, padding=0)}')
73
+
74
+ @staticmethod
75
+ def print_cvar(response: str):
76
+ response = Console.remove_colour_codes(response).removeprefix('print\n')
77
+
78
+ if m := Console.CVAR_REGEX.match(response):
79
+ name = clypi.boxed(
80
+ [m.group('name')], title='Name', width=max(len(m.group('name')) + 4, 30)
81
+ )
82
+ value = clypi.boxed(
83
+ [m.group('value')],
84
+ title='Value',
85
+ width=max(len(m.group('value')) + 4, 30),
86
+ )
87
+ default = clypi.boxed(
88
+ [m.group('default')],
89
+ title='Default',
90
+ width=max(len(m.group('default')) + 4, 30),
91
+ )
92
+ info = clypi.boxed(
93
+ [m.group('info')], title='Info', width=max(len(m.group('info')) + 4, 30)
94
+ )
95
+ print(f'\n{clypi.stack(name, value, default, info, padding=0)}')
@@ -0,0 +1,3 @@
1
+ # SPDX-FileCopyrightText: 2026-present onyx-and-iris <code@onyxandiris.online>
2
+ #
3
+ # SPDX-License-Identifier: MIT