Files
xiaoli-cli/xiaoli/__main__.py
T
Xiaoli Dev a437a2f1dd feat: 默认 TUI 模式,--cli 切换命令行
本次更新由 mimo 自动化执行,与开发者无关。
2026-04-25 11:04:32 +08:00

84 lines
8.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""入口点 - python -m xiaoli"""
import sys
import os
import argparse
import time
from colorama import init
# 确保项目根目录在 sys.path 中
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
def main():
parser = argparse.ArgumentParser(description="小狸 Pro-CLI - 智能编程助手")
parser.add_argument('--cli', action='store_true', help='使用传统 CLI 模式(默认 TUI)')
parser.add_argument('--engine', type=str, help='指定 AI 引擎')
parser.add_argument('--version', action='store_true', help='显示版本')
args = parser.parse_args()
init(autoreset=True)
if args.version:
from xiaoli import __version__
print(f"小狸 Pro-CLI v{__version__}")
return
# 启动动画
_show_art()
from xiaoli.app import App
app = App()
if args.engine:
app._switch_model(args.engine)
if args.cli:
app.run()
else:
app._run_tui()
def _show_art():
"""启动艺术字"""
art = [
"█████████████████████████████████████████████████████████████████████████████████████████████████████",
"██████████ ▒████████████████████████████████████████████████████",
"██████████ ░██████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████",
"██████████ ▓█████████████████████████████████████████████████████████",
"██████████ ▒███████████████████████████████████████████████████████████",
"██████████ █████████████████████████████████████████████████████████████",
"██████████ ███████████████████████████████████████████████████████████████",
"██████████ ▓███████████████████████████████████████████████████████████████",
"██████████ ░████████████████████████████████████████████████████████████████",
"██████████ ██████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████",
"██████████ ▓████████████████████████████████████████████████████████████████████",
"██████████ ░██████████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████████",
"██████████ ██████████████████████████████████████████████████████████████████████████",
"██████████ ░██████████████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████████████",
"██████████ ▓██████████████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████████████",
"██████████ ████████████████████████████████████████████████████████████████████████████",
"███████████ ████████████████████████████████████████████████████████████████████████████",
"█████████████▓ ████████████████████████████████████████████████████████████████████████████",
"█████████████████ ▓██████████████████████████████████████████████████████████████████████████",
"███████████████████▒ ████████████████████████████████████████████████████████████████████████████",
"█████████████████████████████████████████████████████████████████████████████████████████████████████",
"█████████████████████████████████████████████████████████████████████████████████████████████████████",
]
for line in art:
try:
print(line, flush=True)
except UnicodeEncodeError:
pass
time.sleep(0.03)
if __name__ == "__main__":
main()