File tree Expand file tree Collapse file tree 8 files changed +65
-0
lines changed
Expand file tree Collapse file tree 8 files changed +65
-0
lines changed Original file line number Diff line number Diff line change 1+ #################################################
2+ # IMPORTS
3+ #################################################
14from __future__ import annotations
25
36from click import group
69from .cli .manager import Manager
710
811
12+ #################################################
13+ # CODE
14+ #################################################
15+ # Create the main group for the CLI
916@group ()
1017def cli () -> None :
1118 pass
1219
1320
21+ # Add the two command groups
1422cli .add_command (Builder ())
1523cli .add_command (Manager ())
1624
1725
26+ # Create the main entry point
1827def main () -> None :
1928 cli ()
2029
2130
31+ # Execute the programm
2232if __name__ == "__main__" :
2333 main ()
Original file line number Diff line number Diff line change 1+ #################################################
2+ # IMPORTS
3+ #################################################
14from __future__ import annotations
25
36import inspect
1316from .custom_group import CustomGroup
1417from .menu import Menus
1518
19+ #################################################
20+ # CODE
21+ #################################################
1622dicts = dict [str , Any ]
1723
1824
Original file line number Diff line number Diff line change 1+ #################################################
2+ # IMPORTS
3+ #################################################
14from __future__ import annotations
25
36import inspect
69from click import Command , Group
710
811
12+ #################################################
13+ # CODE
14+ #################################################
915class CustomGroup (Group ):
1016
1117 cwd : Path = Path .cwd ()
Original file line number Diff line number Diff line change 1+ #################################################
2+ # IMPORTS
3+ #################################################
14from __future__ import annotations
25
36import inspect
1013from .custom_group import CustomGroup
1114
1215
16+ #################################################
17+ # CODE
18+ #################################################
1319class Manager (CustomGroup ):
1420
1521 def __init__ (self ) -> None :
Original file line number Diff line number Diff line change 1+ #################################################
2+ # IMPORTS
3+ #################################################
14from __future__ import annotations
25
36from typing import Any
912from ..utils .cli import clear , confirm
1013
1114
15+ #################################################
16+ # CODE
17+ #################################################
1218class Menus :
1319
1420 def __init__ (
Original file line number Diff line number Diff line change 1+ #################################################
2+ # IMPORTS
3+ #################################################
14from __future__ import annotations
25
36from pathlib import Path
1013from .files import FileManager
1114
1215
16+ #################################################
17+ # CODE
18+ #################################################
1319class ComposeManager :
1420
1521 def __init__ (self ) -> None :
Original file line number Diff line number Diff line change 1+ #################################################
2+ # IMPORTS
3+ #################################################
14from __future__ import annotations
25
36import json
811import jinja2
912from yaspin import yaspin # type: ignore
1013
14+ #################################################
15+ # CODE
16+ #################################################
1117dicts = dict [str , Any ]
1218
1319
1420class 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" )
Original file line number Diff line number Diff line change 1+ #################################################
2+ # IMPORTS
3+ #################################################
14from __future__ import annotations
25
36from os import name , system
69from InquirerPy import inquirer # type: ignore
710
811
12+ #################################################
13+ # CODE
14+ #################################################
915def 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
1423def 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 ()
You can’t perform that action at this time.
0 commit comments