Unverified Commit 37b7d326 authored by zapashcanon's avatar zapashcanon
Browse files

fmt

parent 280e96ab
...@@ -19,42 +19,48 @@ let () = ...@@ -19,42 +19,48 @@ let () =
match page "index" with match page "index" with
| None -> Dream.empty `Not_Found | None -> Dream.empty `Not_Found
| Some content -> | Some content ->
Dream.html Dream.html (Template.render_unsafe ~title:"title" ~content) )
(Template.render_unsafe ~title:"title" ~content) )
; Dream.get "/badge" (fun request -> ; Dream.get "/badge" (fun request ->
Dream.respond ~headers:["Content-Type", "image/svg+xml"] ( Dream.respond
let open Ocb in ~headers:[ ("Content-Type", "image/svg+xml") ]
let label = match Dream.query "label" request with (let open Ocb in
| None -> "Label" let label =
| Some label -> label match Dream.query "label" request with
in | None -> "Label"
let color = match Dream.query "color" request with | Some label -> label
| None -> Color.Blue in
| Some color -> Color.of_string color let color =
in match Dream.query "color" request with
let style = match Dream.query "style" request with | None -> Color.Blue
| None -> Style.Flat | Some color -> Color.of_string color
| Some style -> Style.of_string style in
in let style =
let label_color = match Dream.query "label_color" request with match Dream.query "style" request with
| None -> Color.Black | None -> Style.Flat
| Some label_color -> Color.of_string label_color | Some style -> Style.of_string style
in in
let status = match Dream.query "status" request with let label_color =
| None -> "Status" match Dream.query "label_color" request with
| Some status -> status | None -> Color.Black
in | Some label_color -> Color.of_string label_color
let scale = match Dream.query "scale" request with in
| None -> 1. let status =
| Some scale -> begin match float_of_string_opt scale with match Dream.query "status" request with
| None -> 1. | None -> "Status"
| Some scale -> scale | Some status -> status
end in
in let scale =
Format.asprintf "%a" ( match Dream.query "scale" request with
Gen.mk ~label ~color ~style ~label_color ~status ~icon:None ~icon_width:0. ~scale | None -> 1.
) () | Some scale -> begin
) match float_of_string_opt scale with
) | None -> 1.
| Some scale -> scale
end
in
Format.asprintf "%a"
(Gen.mk ~label ~color ~style ~label_color ~status ~icon:None
~icon_width:0. ~scale )
()) )
] ]
@@ Dream.not_found @@ Dream.not_found
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment