Files
phbar/Sources/phbar/Models/PHConfig/PHConfig+Env.swift
T

19 lines
512 B
Swift

import Foundation
extension PHConfig {
/// Return a copy with each `[env]` value expanded against `environment`
/// (defaulting to the process environment).
///
/// Unresolved references are left intact (see `PHEnvironment.expand`).
func resolvingEnv(in environment: PHEnvironment = .process) -> PHConfig {
guard let env, !env.isEmpty else { return self }
return PHConfig(
theme: theme,
window: window,
layout: layout,
env: env.mapValues(environment.expand),
monitors: monitors
)
}
}