def of_name
import cswap-bend-cli@0.1.0.0/fmt/code.bend as Codeimport Base
7# The code of a `--format` argument, none for an unknown name.
8def of_name(+s: String) -> Maybe<&2, U32>:
9 Bool.pick(Maybe<&2, U32>, String.eq(s, "text"), Some{0},
10 Bool.pick(Maybe<&2, U32>, String.eq(s, "json"), Some{1},
11 Bool.pick(Maybe<&2, U32>, String.eq(s, "csv"), Some{2},
12 Bool.pick(Maybe<&2, U32>, String.eq(s, "yaml") || String.eq(s, "yml"), Some{3},
13 Bool.pick(Maybe<&2, U32>, String.eq(s, "toon"), Some{4}, None{})))))