startup_stepwise (testSetup3)

This commit is contained in:
MaXFeeD
2025-04-10 20:50:00 +03:00
parent 7f0edfdf79
commit ee2ba1cc63
3 changed files with 63 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "innercore-mod-toolchain"
version = "0.1.0-dev13"
version = "0.1.0-dev14"
description = "Inner Core Mod Toolchain for Horizon is a toolchain that allows you to efficiently develop and build modifications for mobile Minecraft: Bedrock Edition directly from your PC."
authors = [
{ name = "Horizon Team", email = "innercore2018@gmail.com" },
+56 -2
View File
@@ -4,8 +4,9 @@ from os.path import isdir, isfile, join
from typing import Final, List, NoReturn, Optional
from . import GLOBALS
from .shell import (Editable, Interactable, Selectable, abort,
get_toolchain_style, pretty_print, pretty_print_answer)
from .shell import (Editable, Interactable, Selectable, abort, confirm_prompt,
get_toolchain_style, input_prompt, pretty_print,
pretty_print_answer)
from .utils import ensure_not_whitespace, request_typescript
@@ -210,6 +211,59 @@ def startup() -> None:
pretty_print(f"* Setup procedure is completed, Inner Core Mod Toolchain has been installed to {get_script_directory()!r} directory. Execute `icmtoolchain --help` to obtain a list of available commands. You may need to restart your console to be able to access any commands.")
def startup_stepwise() -> None:
tsc = request_typescript(only_check=True) is not None
username = None
typescript = False
def do_next_step(step: int = 0) -> None:
if step == 0:
nonlocal username
username = input_prompt(
"Who are you?",
fallback=get_username(),
explanation="This username, or alias, will be used when creating a project. Author name identifies you on Inner Core Mods."
)
elif step == 1:
nonlocal typescript
typescript = confirm_prompt(
"Do you plan to use Node.js for compilation?",
fallback=tsc,
explanation="This will allow your code to be transpiled by TypeScript Compiler to use ESNext's features, but may increase reassembly time."
)
elif step == 2:
input_prompt(
"Where should we look for projects?",
explanation="If you have used Inner Core Mod Toolchain earlier, you may choose where to search for projects. Either import an obsolete project or modification for Inner Core."
)
else:
return
do_next_step(step + 1)
try:
do_next_step()
except KeyboardInterrupt or EOFError:
pretty_print("* Preconfiguration was canceled, you can do it later, execute `icmtoolchain --help` for a list of commands.")
return None
username = ensure_not_whitespace(username)
if username:
GLOBALS.TOOLCHAIN_CONFIG.set_value("template.author", username)
if typescript:
if GLOBALS.TOOLCHAIN_CONFIG.get_value("denyTypeScript"):
GLOBALS.TOOLCHAIN_CONFIG.remove_value("denyTypeScript")
GLOBALS.TOOLCHAIN_CONFIG.save()
request_typescript()
elif tsc:
GLOBALS.TOOLCHAIN_CONFIG.set_value("denyTypeScript", True)
GLOBALS.TOOLCHAIN_CONFIG.save()
GLOBALS.TOOLCHAIN_CONFIG.save()
pretty_print(f"* Setup procedure is completed, Inner Core Mod Toolchain has been installed to {get_script_directory()!r} directory. Execute `icmtoolchain --help` to obtain a list of available commands. You may need to restart your console to be able to access any commands.")
def startup_questionary() -> None:
from questionary import confirm as qconfirm
from questionary import form as qform
+6
View File
@@ -579,6 +579,12 @@ def task_setup_2() -> int:
startup_questionary()
return 0
@task("testSetup3")
def task_setup_3() -> int:
from .component import startup_stepwise
startup_stepwise()
return 0
@task("testCreate1")
def task_create_1() -> int:
from .package import new_project