Compare commits
No commits in common. "64653f79d57f46960039c27fd10d9c2928edf1d3" and "f0259b04b589dd74fb8d3937bade3ea44413d76e" have entirely different histories.
64653f79d5
...
f0259b04b5
2 changed files with 1 additions and 17 deletions
2
app/dune
2
app/dune
|
@ -1,3 +1,3 @@
|
||||||
(executable
|
(executable
|
||||||
(name mgit)
|
(name mgit)
|
||||||
(libraries mirage-clock-unix logs.fmt fmt.tty git-unix git-kv mirage-crypto-rng.unix))
|
(libraries mirage-clock-unix logs.fmt fmt.tty git-unix git-kv))
|
||||||
|
|
16
app/mgit.ml
16
app/mgit.ml
|
@ -82,15 +82,6 @@ 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)
|
||||||
|
@ -143,9 +134,6 @@ 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
|
||||||
|
@ -181,10 +169,6 @@ let run remote = function
|
||||||
| Ok t -> repl t Unix.stdin
|
| Ok t -> repl t Unix.stdin
|
||||||
| Error (`Msg err) -> Fmt.failwith "%s." err )
|
| Error (`Msg err) -> Fmt.failwith "%s." err )
|
||||||
|
|
||||||
let run remote filename_opt =
|
|
||||||
let () = Mirage_crypto_rng_unix.initialize (module Mirage_crypto_rng.Fortuna) in
|
|
||||||
run remote filename_opt
|
|
||||||
|
|
||||||
let () = match Sys.argv with
|
let () = match Sys.argv with
|
||||||
| [| _; remote; |] -> run remote None
|
| [| _; remote; |] -> run remote None
|
||||||
| [| _; remote; filename; |] when Sys.file_exists filename ->
|
| [| _; remote; filename; |] when Sys.file_exists filename ->
|
||||||
|
|
Loading…
Reference in a new issue