def by_key
cswap-bend-cli@0.1.0.0 · fmt/shape.bend:246
import cswap-bend-cli@0.1.0.0/fmt/shape.bend as Shape
import Base
import cswap-bend-cli@0.1.0.0/json.bend as Json
246def by_key(+key: String, +j: Json.Json) -> String:
247 Bool.pick(String, String.eq(key, "list"), table(account_cols(), items_at(j, "accounts")),
248 Bool.pick(String, String.eq(key, "status"), table(account_cols(), status_rows(get_or_null(j, "active"))),
249 Bool.pick(String, String.eq(key, "config-list"), table(setting_cols(), items_at(j, "settings")),
250 Bool.pick(String, String.eq(key, "profile-list"), table(profile_cols(), items_at(j, "profiles")),
251 Bool.pick(String, String.eq(key, "export"), kv(j), wide(j))))))