app/mgit: Add mtime command to list last_modified
This commit is contained in:
parent
e58a89c4f4
commit
64653f79d5
1 changed files with 12 additions and 0 deletions
12
app/mgit.ml
12
app/mgit.ml
|
@ -82,6 +82,15 @@ let list ~quiet store key =
|
||||||
if not quiet then Fmt.epr "%a.\n%!" Store.pp_error err ;
|
if not quiet then Fmt.epr "%a.\n%!" Store.pp_error err ;
|
||||||
Lwt.return (Ok 1)
|
Lwt.return (Ok 1)
|
||||||
|
|
||||||
|
let last_modified ~quiet store key =
|
||||||
|
Store.last_modified store key >>= function
|
||||||
|
| Ok time ->
|
||||||
|
Fmt.pr "%a\n%!" Ptime.pp time;
|
||||||
|
Lwt.return (Ok 0)
|
||||||
|
| Error err ->
|
||||||
|
if not quiet then Fmt.epr "%a.\n%!" Store.pp_error err ;
|
||||||
|
Lwt.return (Ok 1)
|
||||||
|
|
||||||
let pull ~quiet store =
|
let pull ~quiet store =
|
||||||
Git_kv.pull store >>= function
|
Git_kv.pull store >>= function
|
||||||
| Error (`Msg err) -> if not quiet then Fmt.epr "%s.\n%!" err ; Lwt.return (Ok 1)
|
| Error (`Msg err) -> if not quiet then Fmt.epr "%s.\n%!" err ; Lwt.return (Ok 1)
|
||||||
|
@ -134,6 +143,9 @@ let repl store fd_in =
|
||||||
| [ "list"; key; ] ->
|
| [ "list"; key; ] ->
|
||||||
with_key ~f:(list ~quiet:false store0) key
|
with_key ~f:(list ~quiet:false store0) key
|
||||||
>|= ignore >>= fun () -> go store0
|
>|= ignore >>= fun () -> go store0
|
||||||
|
| [ "mtime"; key; ] ->
|
||||||
|
with_key ~f:(last_modified ~quiet:false store0) key
|
||||||
|
>|= ignore >>= fun () -> go store0
|
||||||
| [ "pull"; ] ->
|
| [ "pull"; ] ->
|
||||||
if is_a_tty then Fmt.pr "\n%!" ; pull ~quiet:false store0
|
if is_a_tty then Fmt.pr "\n%!" ; pull ~quiet:false store0
|
||||||
>|= ignore >>= fun () -> go store0
|
>|= ignore >>= fun () -> go store0
|
||||||
|
|
Loading…
Reference in a new issue