this repo has no description
1(** status command: show build status overview *)
2
3open Cmdliner
4
5let run profile_name profile_dir =
6 match Common.load_profile ~profile_dir ~name:profile_name with
7 | Error (`Msg e) -> Printf.eprintf "Error: %s\n%!" e; 1
8 | Ok (_profile, paths) ->
9 match Common.latest_snapshot_dir paths with
10 | None -> Printf.printf "No snapshots found\n"; 1
11 | Some snapshot_dir ->
12 match Day11_lib.Status_index.read ~dir:snapshot_dir with
13 | None ->
14 Printf.printf "No status.json found\n";
15 1
16 | Some status ->
17 Printf.printf "Run: %s (generated %s)\n" status.run_id status.generated;
18 Printf.printf "\nBlessed:\n";
19 List.iter (fun (cat, n) ->
20 Printf.printf " %-20s %d\n" cat n
21 ) status.blessed_totals;
22 Printf.printf "\nNon-blessed:\n";
23 List.iter (fun (cat, n) ->
24 Printf.printf " %-20s %d\n" cat n
25 ) status.non_blessed_totals;
26 if status.changes <> [] then begin
27 Printf.printf "\nChanges since last run:\n";
28 List.iter (fun (c : Day11_lib.Status_index.change) ->
29 Printf.printf " %s: %s → %s%s\n"
30 c.package c.from_status c.to_status
31 (if c.blessed then " [blessed]" else "")
32 ) status.changes
33 end;
34 if status.new_packages <> [] then begin
35 Printf.printf "\nNew packages: %s\n"
36 (String.concat ", " status.new_packages)
37 end;
38 0
39
40let cmd =
41 let info = Cmd.info "status" ~doc:"Show build status overview" in
42 let term = Term.(const run $ Common.profile_term $ Common.profile_dir_term) in
43 Cmd.v info term