Class: EasyAI::EasyAIApp

Inherits:
Object
  • Object
show all
Defined in:
lib/easyai.rb

Overview

EasyAI 应用程序主类

Instance Method Summary collapse

Instance Method Details

#run(argv) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/easyai.rb', line 19

def run(argv)
  # 解析参数以确定是否显示启动标志
  require 'claide'
  require 'colored2'
  coerced_argv = CLAide::ARGV.coerce(argv)

  # 如果不是帮助或版本查询,显示启动标志
  unless coerced_argv.flag?('help') || coerced_argv.flag?('version')
    show_banner
  end

  # 在运行命令前进行版本检查
  check_version_before_run(argv)

  # 设置退出时清理
  setup_cleanup_handler

  # 运行命令
  EasyAI::Command.run(argv)
ensure
  # 确保清理临时文件
  cleanup_temp_files
end