def scalar_kind

near-v-framework@0.4.0.0 · domain/architecture/system/deployment/nix_darwin/setting/ops.bend:211

import near-v-framework@0.4.0.0/domain/architecture/system/deployment/nix_darwin/setting/ops.bend as Ops
import Base
import near-v-framework@0.4.0.0/domain/architecture/system/deployment/nix_darwin/setting/type.bend as St

211# ---- system.defaults: which options (nix/options.tsv, "option<TAB>type"), and where macOS keeps them ----
212# How an option's type reads from a plist; KNix for the types that are not one scalar (not read).
213def scalar_kind(+t: String) -> St.ValueKind:
214  Bool.pick(St.ValueKind, String.eq(t, "boolean"), St.KBool{},
215  Bool.pick(St.ValueKind, String.starts_with(t, "floating point"), St.KFloat{},
216  Bool.pick(St.ValueKind, String.starts_with(t, "signed integer") || String.starts_with(t, "(positive integer") || String.starts_with(t, "integer between") || String.starts_with(t, "one of 0") || String.starts_with(t, "one of 1") || String.starts_with(t, "value 1"), St.KInt{},
217  Bool.pick(St.ValueKind, String.eq(t, "string") || String.eq(t, "absolute path") || String.starts_with(t, "one of \"") || String.starts_with(t, "value \""), St.KStr{}, St.KNix{}))))

Uses (6)

Used by (1)