take timestamp-in-listings from config

main
Hannes Mehnert 5 months ago
parent 8c461402bf
commit 7b0ccbf37e
  1. 10
      app/canopy_app.ml
  2. 1
      canopy.opam
  3. 3
      dune-project
  4. 5
      src/canopy.ml
  5. 2
      src/canopy.mli

@ -1,6 +1,6 @@
let jump () repository content generated timestamp_in_listings =
let jump () repository content generated =
let now = Option.get Ptime.(Span.to_int_s (to_span (Ptime_clock.now ()))) |> Int64.of_int in
Lwt_main.run (Canopy.convert repository ~content ~generated ~timestamp_in_listings ~now)
Lwt_main.run (Canopy.convert repository ~content ~generated ~now)
let setup_log style_renderer level =
Fmt_tty.setup_std_outputs ?style_renderer ();
@ -26,13 +26,9 @@ let generated =
let doc = "Git branch of generated HTML" in
Arg.(value & opt string "pages" & info [ "generated" ] ~doc ~docv:"BRANCH")
let timestamp_in_listings =
let doc = "Include timestamp in listings" in
Arg.(value & flag & info [ "timestamp-in-listings" ] ~doc)
let cmd =
let term =
Term.(term_result (const jump $ setup_log $ repository $ content $ generated $ timestamp_in_listings))
Term.(term_result (const jump $ setup_log $ repository $ content $ generated))
and info = Cmd.info "canopy" ~version:"%%VERSION_NUM%%"
in
Cmd.v info term

@ -1 +1,2 @@
(lang dune 1.0)
(lang dune 1.0)
(name canopy)

@ -104,11 +104,14 @@ let push_to_branch repository ~branch ~source ~source_commit data ~now =
Canopy_store.Store.Commit.v repo ~info ~parents tree' >>= fun commit ->
Canopy_store.Store.Head.set s commit
let convert repository ~content ~generated ~timestamp_in_listings ~now =
let convert repository ~content ~generated ~now =
Canopy_store.init repository content >>= fun () ->
Canopy_store.base_uuid () >>= fun uuid ->
Canopy_store.fill_cache uuid >>= fun cache ->
let highlight = KeyMap.mem [ "static" ; "js" ; "highlight.pack.js" ] cache in
let timestamp_in_listings =
KeyMap.mem [ ".config" ; "timestamp-listings" ] cache
in
let indexes_needed =
let rec all_rec xs =
match xs with

@ -1,3 +1,3 @@
val convert : string -> content:string -> generated:string -> timestamp_in_listings:bool -> now:int64 ->
val convert : string -> content:string -> generated:string -> now:int64 ->
(unit, [ `Msg of string ]) result Lwt.t

Loading…
Cancel
Save