import { REGIONS_FILE } from './paths.ts'

export async function listRegions(): Promise<string[]> {
  const text = await Deno.readTextFile(REGIONS_FILE)
  return text.split('\n').map((l) => l.trim()).filter(Boolean)
}

export function leafName(region: string): string {
  const parts = region.split('/')
  return parts[parts.length - 1]
}
