Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

App

启动流程(thurgio_cli::cli::init):

  1. 若子命令为 generateversion,直接执行并返回(不需要 logger)。
  2. 初始化 logger:
    • 读取 RUST_LOG 过滤级别,默认 info(如 info,thurgio=debug 表示所有 crate 启用 info 级,thurgio 启用 debug 级;也可用于关闭某些 crate 的日志)。
    • 读取 RUST_LOG_ANSI,为 true 时启用颜色;未设置时自动检测(stdout 为 TTY 才启用)。同时控制 logger 与 CLI 彩色输出(owo-colors,如 build/)。
    • 读取 RUST_LOG_FORMAT,为 json 时输出 JSON 日志。
  3. 若子命令为 init,生成配置并返回(需要 logger,不需要配置)。
  4. 若设置了 -r/--root(或 ROOT 环境变量),set_root_dir 创建并切换到该目录。
  5. 初始化 Config 和 Renderer(thurgio_app::initialize:Source → AppState → 熔断器状态恢复)。
  6. 执行子命令(build/check/diff/upgrade/serve)。

不带子命令直接运行 thurgio 只执行初始化(加载配置)后退出。