Skip to main content

resolve_backend

Function resolve_backend 

Source
pub fn resolve_backend(
    parsed_input: &ParsedInput,
    allow_user_repo_fetch: bool,
) -> WtgResult<Box<dyn Backend>>
Expand description

Resolve the best backend based on available resources.

§Arguments

  • parsed_input - The parsed user input
  • allow_user_repo_fetch - If true, allow fetching into user’s local repo

Decision tree:

  1. Explicit repo info provided → Use cached/cloned repo + GitHub API (hard error if GitHub client fails)
  2. In local repo with GitHub remote → Combined backend (soft notice if GitHub client fails)
  3. In local repo without GitHub remote → Git-only backend with appropriate notice
  4. Not in repo and no info → Error