mirror of
https://github.com/dw-0/kiauh.git
synced 2026-08-03 04:47:56 +05:00
Add core.cli with argparse-based install/remove/update commands for Klipper, Moonraker, Mainsail/Fluidd and client configs. Wire main.py to dispatch to the CLI and fall back to the TUI when no args are given. Pass CLI arguments through kiauh.sh and skip the update dialog for non-interactive runs.
39 lines
1.3 KiB
Python
39 lines
1.3 KiB
Python
# ======================================================================= #
|
|
# Copyright (C) 2020 - 2026 Dominik Willner <th33xitus@gmail.com> #
|
|
# #
|
|
# This file is part of KIAUH - Klipper Installation And Update Helper #
|
|
# https://github.com/dw-0/kiauh #
|
|
# #
|
|
# This file may be distributed under the terms of the GNU GPLv3 license #
|
|
# ======================================================================= #
|
|
import io
|
|
import sys
|
|
|
|
from core.cli import run_cli
|
|
from core.logger import Logger
|
|
from core.menus.main_menu import MainMenu
|
|
from core.settings.kiauh_settings import KiauhSettings
|
|
|
|
|
|
def ensure_encoding() -> None:
|
|
if sys.stdout.encoding == "UTF-8" or not isinstance(sys.stdout, io.TextIOWrapper):
|
|
return
|
|
sys.stdout.reconfigure(encoding="utf-8")
|
|
|
|
|
|
def main() -> None:
|
|
rc = run_cli()
|
|
if rc == -1:
|
|
try:
|
|
KiauhSettings()
|
|
ensure_encoding()
|
|
MainMenu().run()
|
|
except KeyboardInterrupt:
|
|
Logger.print_ok("\nHappy printing!\n", prefix=False)
|
|
elif rc > 0:
|
|
sys.exit(rc)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|