Skip to content

Commit 636cebd

Browse files
committed
Added small comments
1 parent 0b1f418 commit 636cebd

File tree

8 files changed

+65
-0
lines changed

8 files changed

+65
-0
lines changed

src/__main__.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#################################################
2+
# IMPORTS
3+
#################################################
14
from __future__ import annotations
25

36
from click import group
@@ -6,18 +9,25 @@
69
from .cli.manager import Manager
710

811

12+
#################################################
13+
# CODE
14+
#################################################
15+
# Create the main group for the CLI
916
@group()
1017
def cli() -> None:
1118
pass
1219

1320

21+
# Add the two command groups
1422
cli.add_command(Builder())
1523
cli.add_command(Manager())
1624

1725

26+
# Create the main entry point
1827
def main() -> None:
1928
cli()
2029

2130

31+
# Execute the programm
2232
if __name__ == "__main__":
2333
main()

src/cli/builder.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#################################################
2+
# IMPORTS
3+
#################################################
14
from __future__ import annotations
25

36
import inspect
@@ -13,6 +16,9 @@
1316
from .custom_group import CustomGroup
1417
from .menu import Menus
1518

19+
#################################################
20+
# CODE
21+
#################################################
1622
dicts = dict[str, Any]
1723

1824

src/cli/custom_group.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#################################################
2+
# IMPORTS
3+
#################################################
14
from __future__ import annotations
25

36
import inspect
@@ -6,6 +9,9 @@
69
from click import Command, Group
710

811

12+
#################################################
13+
# CODE
14+
#################################################
915
class CustomGroup(Group):
1016

1117
cwd: Path = Path.cwd()

src/cli/manager.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#################################################
2+
# IMPORTS
3+
#################################################
14
from __future__ import annotations
25

36
import inspect
@@ -10,6 +13,9 @@
1013
from .custom_group import CustomGroup
1114

1215

16+
#################################################
17+
# CODE
18+
#################################################
1319
class Manager(CustomGroup):
1420

1521
def __init__(self) -> None:

src/cli/menu.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#################################################
2+
# IMPORTS
3+
#################################################
14
from __future__ import annotations
25

36
from typing import Any
@@ -9,6 +12,9 @@
912
from ..utils.cli import clear, confirm
1013

1114

15+
#################################################
16+
# CODE
17+
#################################################
1218
class Menus:
1319

1420
def __init__(

src/core/docker.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#################################################
2+
# IMPORTS
3+
#################################################
14
from __future__ import annotations
25

36
from pathlib import Path
@@ -10,6 +13,9 @@
1013
from .files import FileManager
1114

1215

16+
#################################################
17+
# CODE
18+
#################################################
1319
class ComposeManager:
1420

1521
def __init__(self) -> None:

src/core/files.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#################################################
2+
# IMPORTS
3+
#################################################
14
from __future__ import annotations
25

36
import json
@@ -8,14 +11,24 @@
811
import jinja2
912
from yaspin import yaspin # type: ignore
1013

14+
#################################################
15+
# CODE
16+
#################################################
1117
dicts = dict[str, Any]
1218

1319

1420
class FileManager:
21+
"""
22+
File manager class. Incharge of reading, writting and creating files.
23+
"""
1524

1625
cwd = Path.cwd()
1726

1827
def save_files(self, data: dicts, build: bool = False) -> None:
28+
"""
29+
Create/Update files and save them. Also copies the asset files.
30+
"""
31+
1932
tmps_path = files("minecraft-docker-cli.assets.templates")
2033
composer_template = tmps_path.joinpath("docker-compose.yml.j2")
2134
env_template = tmps_path.joinpath(".env.j2")

src/utils/cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#################################################
2+
# IMPORTS
3+
#################################################
14
from __future__ import annotations
25

36
from os import name, system
@@ -6,12 +9,21 @@
69
from InquirerPy import inquirer # type: ignore
710

811

12+
#################################################
13+
# CODE
14+
#################################################
915
def clear(t: float) -> None:
16+
"""
17+
Sleep t seconds and clear the console.
18+
"""
1019
sleep(t)
1120
system("cls" if name == "nt" else "clear")
1221

1322

1423
def confirm(msg: str, default: bool = False) -> bool:
24+
"""
25+
Ask for confirmation with custom message and default value
26+
"""
1527
return inquirer.confirm( # type: ignore
1628
message=msg, default=default
1729
).execute()

0 commit comments

Comments
 (0)