module

Cl8r::CLI::FileResolver

Centralized file resolution logic prioritizing .yaml files with fallback to .yml.

Class methods

resolve_input_file(explicit_path : String | Nil = nil, default_base : String = "cluster") : String

Resolves an input cluster specification path. Rules:

  1. If explicit_path is provided and exists, return it.
  2. If explicit_path without extension exists with .yaml or .yml, return that.
  3. If explicit_path is nil or is default ("cluster.yaml" or "cluster.yml"):
    • Check if "cluster.yaml" exists -> return "cluster.yaml"
    • Check if "cluster.yml" exists -> return "cluster.yml"
    • Default to "cluster.yaml"
Source