Skip to content

Commit

Permalink
Cleanup logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Nov 24, 2024
1 parent b18d14a commit 60a2ee1
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/core/builtins/builtins_server.ml
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ let _ =
]
Lang.unit_t
(fun p ->
let namespace =
Option.value ~default:""
(Option.map Lang.to_string
(Lang.to_option (List.assoc "namespace" p)))
let ns =
match
Lang.to_valued_option Lang.to_string (List.assoc "namespace" p)
with
| None -> []
| Some s -> Re.Pcre.split ~rex:(Re.Pcre.regexp "\\.") s
in
let descr = Lang.to_string (List.assoc "description" p) in
let command = Lang.to_string (Lang.assoc "" 1 p) in
Expand All @@ -64,6 +66,5 @@ let _ =
in
let f = Lang.assoc "" 2 p in
let f x = Lang.to_string (Lang.apply f [("", Lang.string x)]) in
let ns = Re.Pcre.split ~rex:(Re.Pcre.regexp "\\.") namespace in
Server.add ~ns ~usage ~descr command f;
Lang.unit)

0 comments on commit 60a2ee1

Please sign in to comment.