Last change
on this file since 74 was 73, checked in by Izuru Yakumo, 8 months ago |
Because sweet girls are the best, officially rebranding Logarion to Kosuzu
Signed-off-by: Izuru Yakumo <yakumo.izuru@…>
|
File size:
993 bytes
|
Rev | Line | |
---|
[73] | 1 | open Kosuzu
|
---|
| 2 |
|
---|
| 3 | let last a ((t,_) as pair) = match a with
|
---|
| 4 | | None -> Some pair
|
---|
| 5 | | Some (t', _) as pair' ->
|
---|
| 6 | if Text.newest t t' > 0 then Some pair else pair'
|
---|
| 7 |
|
---|
| 8 | let last_mine a ((t, _) as pair) =
|
---|
| 9 | let name = Person.Set.of_string (Sys.getenv "USER") in
|
---|
| 10 | let open Text in
|
---|
| 11 | match a with
|
---|
| 12 | | None -> if Person.Set.subset name t.authors then Some pair else None
|
---|
| 13 | | Some (t', _) as pair' ->
|
---|
| 14 | if Text.newest t t' > 0 && Person.Set.subset name t'.authors
|
---|
| 15 | then Some pair else pair'
|
---|
| 16 |
|
---|
| 17 | let last search_mine =
|
---|
| 18 | let filter = if search_mine then last_mine else last in
|
---|
| 19 | match File_store.fold filter None with
|
---|
| 20 | | None -> ()
|
---|
| 21 | | Some (_, f) -> List.iter print_endline f
|
---|
| 22 |
|
---|
| 23 | open Cmdliner
|
---|
| 24 |
|
---|
| 25 | let mine = Arg.(value & flag & info ["mine"] ~doc: "Last text authored by me")
|
---|
| 26 | let last_t = Term.(const last $ mine)
|
---|
| 27 |
|
---|
| 28 | let cmd =
|
---|
| 29 | let doc = "Most recent text" in
|
---|
| 30 | let man = [
|
---|
| 31 | `S Manpage.s_description;
|
---|
| 32 | `P "Print the filename of most recent text" ]
|
---|
| 33 | in
|
---|
| 34 | let info = Cmd.info "last" ~doc ~man in
|
---|
| 35 | Cmd.v info last_t
|
---|
Note:
See
TracBrowser
for help on using the repository browser.