bsm-cli 1.6.0b3__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.
Files changed (32) hide show
  1. bsm_cli-1.6.0b3/LICENSE +21 -0
  2. bsm_cli-1.6.0b3/PKG-INFO +77 -0
  3. bsm_cli-1.6.0b3/README.md +46 -0
  4. bsm_cli-1.6.0b3/pyproject.toml +71 -0
  5. bsm_cli-1.6.0b3/setup.cfg +4 -0
  6. bsm_cli-1.6.0b3/src/bsm_cli/__init__.py +0 -0
  7. bsm_cli-1.6.0b3/src/bsm_cli/__main__.py +88 -0
  8. bsm_cli-1.6.0b3/src/bsm_cli/account.py +75 -0
  9. bsm_cli-1.6.0b3/src/bsm_cli/addon.py +362 -0
  10. bsm_cli-1.6.0b3/src/bsm_cli/allowlist.py +229 -0
  11. bsm_cli-1.6.0b3/src/bsm_cli/auth.py +106 -0
  12. bsm_cli-1.6.0b3/src/bsm_cli/backup.py +263 -0
  13. bsm_cli-1.6.0b3/src/bsm_cli/bans.py +190 -0
  14. bsm_cli-1.6.0b3/src/bsm_cli/config.py +89 -0
  15. bsm_cli-1.6.0b3/src/bsm_cli/content.py +21 -0
  16. bsm_cli-1.6.0b3/src/bsm_cli/decorators.py +138 -0
  17. bsm_cli-1.6.0b3/src/bsm_cli/main_menus.py +293 -0
  18. bsm_cli-1.6.0b3/src/bsm_cli/permissions.py +191 -0
  19. bsm_cli-1.6.0b3/src/bsm_cli/player.py +59 -0
  20. bsm_cli-1.6.0b3/src/bsm_cli/plugins.py +296 -0
  21. bsm_cli-1.6.0b3/src/bsm_cli/properties.py +197 -0
  22. bsm_cli-1.6.0b3/src/bsm_cli/server.py +471 -0
  23. bsm_cli-1.6.0b3/src/bsm_cli/system.py +142 -0
  24. bsm_cli-1.6.0b3/src/bsm_cli/users.py +245 -0
  25. bsm_cli-1.6.0b3/src/bsm_cli/world.py +171 -0
  26. bsm_cli-1.6.0b3/src/bsm_cli.egg-info/PKG-INFO +77 -0
  27. bsm_cli-1.6.0b3/src/bsm_cli.egg-info/SOURCES.txt +30 -0
  28. bsm_cli-1.6.0b3/src/bsm_cli.egg-info/dependency_links.txt +1 -0
  29. bsm_cli-1.6.0b3/src/bsm_cli.egg-info/entry_points.txt +2 -0
  30. bsm_cli-1.6.0b3/src/bsm_cli.egg-info/requires.txt +14 -0
  31. bsm_cli-1.6.0b3/src/bsm_cli.egg-info/top_level.txt +1 -0
  32. bsm_cli-1.6.0b3/tests/test_cli_websocket.py +147 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Danny
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,77 @@
1
+ Metadata-Version: 2.4
2
+ Name: bsm-cli
3
+ Version: 1.6.0b3
4
+ Summary: A CLI for managing Bedrock servers via BSM API
5
+ Author-email: DMedina559 <dmedina559-github@outlook.com>
6
+ Project-URL: Homepage, https://github.com/DMedina559/bsm-api-client
7
+ Keywords: minecraft,bedrock,server,manager,cli
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Intended Audience :: Developers
14
+ Requires-Python: >=3.11
15
+ Description-Content-Type: text/markdown
16
+ License-File: LICENSE
17
+ Requires-Dist: click<8.5,>=8.2.0
18
+ Requires-Dist: questionary<2.2,>=2.1.0
19
+ Requires-Dist: bsm-api-client
20
+ Provides-Extra: dev
21
+ Requires-Dist: pytest<9.2,>=8.4.0; extra == "dev"
22
+ Requires-Dist: pytest-mock<3.16,>=3.14.0; extra == "dev"
23
+ Requires-Dist: pytest-asyncio<1.5,>=1.1.0; extra == "dev"
24
+ Requires-Dist: black<26.6,>=25.1.0; extra == "dev"
25
+ Requires-Dist: flake8<7.4,>=7.3.0; extra == "dev"
26
+ Requires-Dist: isort<8.1,>=5.13.0; extra == "dev"
27
+ Requires-Dist: mypy<2.2,>=1.10.0; extra == "dev"
28
+ Requires-Dist: bedrock-server-manager<3.11.0,>=3.10.0b3; extra == "dev"
29
+ Requires-Dist: pre-commit<4.7,>=4.6.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ <div style="text-align: center;">
33
+ <img src="https://raw.githubusercontent.com/DMedina559/bsm-frontend/main/frontend/public/image/icon/favicon.svg" alt="BSM Logo" width="150">
34
+ </div>
35
+
36
+ # bsm-cli
37
+
38
+ <p align="center">
39
+ <a href="https://github.com/DMedina559/bsm-api-client/releases">
40
+ <img alt="Stable" src="https://img.shields.io/github/v/release/DMedina559/bsm-api-client?label=Stable&color=blue">
41
+ </a>
42
+ <a href="https://github.com/DMedina559/bsm-api-client/releases">
43
+ <img alt="Pre-Release" src="https://img.shields.io/github/v/release/DMedina559/bsm-api-client?include_prereleases&label=Pre-Release&color=red">
44
+ </a>
45
+ <a href="https://github.com/DMedina559/bsm-api-client/actions">
46
+ <img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/DMedina559/bsm-api-client/build-test.yml?label=Tests&event=push">
47
+ </a>
48
+ </p>
49
+
50
+ ## Introduction
51
+
52
+ `bsm-cli` is a command-line interface tool for managing Minecraft Bedrock Dedicated Servers via the Bedrock Server Manager API.
53
+
54
+ ## Features
55
+
56
+ * Full CLI interface using `click` and `questionary`.
57
+ * Interactive menus for server management.
58
+ * Realtime server state updates via WebSocket.
59
+ * Seamlessly manages configuration for server and backups.
60
+
61
+ ## Installation
62
+
63
+ Install the library using pip:
64
+
65
+ ```bash
66
+ pip install bsm-cli
67
+ ```
68
+
69
+ ## Quick Start
70
+
71
+ You can invoke the CLI using:
72
+
73
+ ```bash
74
+ bsm-cli
75
+ ```
76
+
77
+ Which will trigger the interactive menu allowing you to manage and configure your Bedrock Dedicated Servers.
@@ -0,0 +1,46 @@
1
+ <div style="text-align: center;">
2
+ <img src="https://raw.githubusercontent.com/DMedina559/bsm-frontend/main/frontend/public/image/icon/favicon.svg" alt="BSM Logo" width="150">
3
+ </div>
4
+
5
+ # bsm-cli
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/DMedina559/bsm-api-client/releases">
9
+ <img alt="Stable" src="https://img.shields.io/github/v/release/DMedina559/bsm-api-client?label=Stable&color=blue">
10
+ </a>
11
+ <a href="https://github.com/DMedina559/bsm-api-client/releases">
12
+ <img alt="Pre-Release" src="https://img.shields.io/github/v/release/DMedina559/bsm-api-client?include_prereleases&label=Pre-Release&color=red">
13
+ </a>
14
+ <a href="https://github.com/DMedina559/bsm-api-client/actions">
15
+ <img alt="Tests" src="https://img.shields.io/github/actions/workflow/status/DMedina559/bsm-api-client/build-test.yml?label=Tests&event=push">
16
+ </a>
17
+ </p>
18
+
19
+ ## Introduction
20
+
21
+ `bsm-cli` is a command-line interface tool for managing Minecraft Bedrock Dedicated Servers via the Bedrock Server Manager API.
22
+
23
+ ## Features
24
+
25
+ * Full CLI interface using `click` and `questionary`.
26
+ * Interactive menus for server management.
27
+ * Realtime server state updates via WebSocket.
28
+ * Seamlessly manages configuration for server and backups.
29
+
30
+ ## Installation
31
+
32
+ Install the library using pip:
33
+
34
+ ```bash
35
+ pip install bsm-cli
36
+ ```
37
+
38
+ ## Quick Start
39
+
40
+ You can invoke the CLI using:
41
+
42
+ ```bash
43
+ bsm-cli
44
+ ```
45
+
46
+ Which will trigger the interactive menu allowing you to manage and configure your Bedrock Dedicated Servers.
@@ -0,0 +1,71 @@
1
+ [build-system]
2
+ requires = ["setuptools>=80.9", "setuptools_scm"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "bsm-cli"
7
+ dynamic = ["version"]
8
+ authors = [
9
+ { name="DMedina559", email="dmedina559-github@outlook.com" },
10
+ ]
11
+ description = "A CLI for managing Bedrock servers via BSM API"
12
+ readme = "README.md"
13
+ license-files = ["LICENSE"]
14
+ requires-python = ">=3.11"
15
+ classifiers = [
16
+ "Programming Language :: Python :: 3",
17
+ "Programming Language :: Python :: 3.11",
18
+ "Programming Language :: Python :: 3.12",
19
+ "Programming Language :: Python :: 3.13",
20
+ "Operating System :: OS Independent",
21
+ "Intended Audience :: Developers",
22
+ ]
23
+ dependencies = [
24
+ "click >=8.2.0,<8.5",
25
+ "questionary >=2.1.0,<2.2",
26
+ "bsm-api-client",
27
+ ]
28
+ keywords = ["minecraft", "bedrock", "server", "manager", "cli"]
29
+
30
+ [project.optional-dependencies]
31
+ dev = [
32
+ "pytest >=8.4.0,<9.2",
33
+ "pytest-mock >=3.14.0,<3.16",
34
+ "pytest-asyncio >= 1.1.0,< 1.5",
35
+ "black >=25.1.0,<26.6",
36
+ "flake8 >=7.3.0,<7.4",
37
+ "isort >=5.13.0,<8.1",
38
+ "mypy >=1.10.0,<2.2",
39
+ "bedrock-server-manager >=3.10.0b3,<3.11.0",
40
+ "pre-commit >=4.6.0,<4.7",
41
+ ]
42
+
43
+ [project.urls]
44
+ "Homepage" = "https://github.com/DMedina559/bsm-api-client"
45
+
46
+ [project.scripts]
47
+ bsm-cli = "bsm_cli.__main__:cli"
48
+
49
+ [tool.setuptools.packages.find]
50
+ where = ["src"]
51
+ include = ["bsm_cli*"]
52
+
53
+ [tool.setuptools_scm]
54
+ root = "../.."
55
+ local_scheme = "no-local-version"
56
+
57
+ [tool.black]
58
+
59
+ [tool.isort]
60
+ profile = "black"
61
+ line_length = 88
62
+
63
+ [tool.mypy]
64
+ python_version = "3.11"
65
+ warn_return_any = true
66
+ warn_unused_configs = true
67
+ ignore_missing_imports = true
68
+
69
+ [tool.pytest.ini_options]
70
+ testpaths = ["tests"]
71
+ asyncio_mode = "auto"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
File without changes
@@ -0,0 +1,88 @@
1
+ try:
2
+ import click
3
+
4
+ except ImportError:
5
+ print(
6
+ "Please install the required dependencies with `pip install bsm-api-client[cli]`"
7
+ )
8
+ exit(1)
9
+
10
+
11
+ from contextlib import asynccontextmanager
12
+
13
+ from bsm_cli.account import account
14
+ from bsm_cli.addon import addon
15
+ from bsm_cli.allowlist import allowlist
16
+ from bsm_cli.auth import auth
17
+ from bsm_cli.backup import backup
18
+ from bsm_cli.bans import bans
19
+ from bsm_cli.config import Config
20
+ from bsm_cli.content import content
21
+ from bsm_cli.decorators import AsyncGroup
22
+ from bsm_cli.main_menus import main_menu
23
+ from bsm_cli.permissions import permissions
24
+ from bsm_cli.player import player
25
+ from bsm_cli.plugins import plugin
26
+ from bsm_cli.properties import properties
27
+ from bsm_cli.server import server
28
+ from bsm_cli.system import system
29
+ from bsm_cli.users import users
30
+ from bsm_cli.world import world
31
+
32
+ from bsm_api_client import BedrockServerManagerApi
33
+
34
+
35
+ @click.group(cls=AsyncGroup, invoke_without_command=True)
36
+ @click.pass_context
37
+ def cli(ctx):
38
+ """A CLI for managing Bedrock servers."""
39
+ ctx.obj["cli"] = cli
40
+ if ctx.invoked_subcommand is None:
41
+ return main_menu(ctx)
42
+
43
+
44
+ @cli.context
45
+ @asynccontextmanager
46
+ async def cli_context(ctx):
47
+ config = Config()
48
+ ctx.obj["config"] = config
49
+
50
+ try:
51
+ client = BedrockServerManagerApi(
52
+ base_url=config.base_url,
53
+ jwt_token=config.jwt_token,
54
+ verify_ssl=config.verify_ssl,
55
+ )
56
+ except ValueError as e:
57
+ # Ignore AuthError when logging out or auth group is called
58
+ if ctx.invoked_subcommand == auth or ctx.invoked_subcommand is None:
59
+ client = None
60
+ else:
61
+ raise e
62
+ ctx.obj["client"] = client
63
+
64
+ try:
65
+ yield
66
+ finally:
67
+ if ctx.obj.get("client"):
68
+ await ctx.obj["client"].close()
69
+
70
+
71
+ cli.add_command(auth)
72
+ cli.add_command(server)
73
+ cli.add_command(addon)
74
+ cli.add_command(backup)
75
+ cli.add_command(player)
76
+ cli.add_command(plugin)
77
+ cli.add_command(allowlist)
78
+ cli.add_command(bans)
79
+ cli.add_command(permissions)
80
+ cli.add_command(properties)
81
+ cli.add_command(system)
82
+ cli.add_command(world)
83
+ cli.add_command(account)
84
+ cli.add_command(content)
85
+ cli.add_command(users)
86
+
87
+ if __name__ == "__main__":
88
+ cli()
@@ -0,0 +1,75 @@
1
+ # src/bsm_cli/account.py
2
+ """CLI commands for account management."""
3
+
4
+ import click
5
+ from bsm_cli.decorators import pass_async_context
6
+
7
+
8
+ @click.group()
9
+ def account():
10
+ """Commands for managing your account."""
11
+ pass
12
+
13
+
14
+ @account.command()
15
+ @pass_async_context
16
+ async def details(ctx):
17
+ """Get your account details."""
18
+ client = ctx.obj["client"]
19
+ details = await client.async_get_account_details()
20
+ click.echo(details.model_dump_json(indent=2))
21
+
22
+
23
+ @account.command()
24
+ @click.option("--theme", prompt="Theme name", help="The name of the theme to set.")
25
+ @pass_async_context
26
+ async def update_theme(ctx, theme):
27
+ """Update your theme."""
28
+ from bsm_api_client.models import ThemeUpdatePayload
29
+
30
+ client = ctx.obj["client"]
31
+ payload = ThemeUpdatePayload(theme=theme)
32
+ response = await client.async_update_theme(payload)
33
+ click.echo(response.model_dump_json(indent=2))
34
+
35
+
36
+ @account.command()
37
+ @click.option("--full-name", prompt="Full Name", help="Your full name.")
38
+ @click.option("--email", prompt="Email", help="Your email address.")
39
+ @pass_async_context
40
+ async def update_profile(ctx, full_name, email):
41
+ """Update your profile."""
42
+ from bsm_api_client.models import ProfileUpdatePayload
43
+
44
+ client = ctx.obj["client"]
45
+ payload = ProfileUpdatePayload(full_name=full_name, email=email)
46
+ response = await client.async_update_profile(payload)
47
+ click.echo(response.model_dump_json(indent=2))
48
+
49
+
50
+ @account.command()
51
+ @click.option(
52
+ "--current-password",
53
+ prompt=True,
54
+ hide_input=True,
55
+ confirmation_prompt=False,
56
+ help="Your current password.",
57
+ )
58
+ @click.option(
59
+ "--new-password",
60
+ prompt=True,
61
+ hide_input=True,
62
+ confirmation_prompt=True,
63
+ help="Your new password.",
64
+ )
65
+ @pass_async_context
66
+ async def change_password(ctx, current_password, new_password):
67
+ """Change your password."""
68
+ from bsm_api_client.models import ChangePasswordPayload
69
+
70
+ client = ctx.obj["client"]
71
+ payload = ChangePasswordPayload(
72
+ current_password=current_password, new_password=new_password
73
+ )
74
+ response = await client.async_change_password(payload)
75
+ click.echo(response.model_dump_json(indent=2))