Format - New B32 ID Index - New option: txt index --print - Move scheme to peers - Replace peer.*.conf files with index packed locations Instead of adding a URL to peers.*.conf, run `txt pull <url>` Conversion - Rewritten converters - txt-convert looks for a .convert.conf containing `key: value` lines. - Specifiable topic-roots from .convert.conf. - Added `Topics:` key, with comma seperated topics. If set only those topics will appear in the main index and used as topic roots. Other topics will have sub-indices generated, but won't be listed in the main index. - HTML converter header & footer options - HTML-index renamed to HTM-index Internal - Change types: uuid:Uuid -> id:string - File_store merges identical texts - Use peer ID for store path, store peers' texts in .local/share/texts - Simple URN resolution for converter Continue to next feed if parsing one fails - Phasing-out Archive, replaced by improved packs - Eliminate Bos, Cohttp, lwt, uri, tls, Re, Ptime, dependencies - Lock version for Cmdliner, fix dune-project - Optional resursive store - Improve header_pack - Fix recursive mkdir git-svn-id: file:///srv/svn/repo/kosuzu/trunk@3 eb64cd80-c68d-6f47-b6a3-0ada418499da
39 lines
1.8 KiB
OCaml
39 lines
1.8 KiB
OCaml
open Logarion
|
|
module FS = File_store
|
|
module A = Archive
|
|
let listing r order_opt reverse_opt number_opt authors_opt topics_opt =
|
|
let predicates = A.predicate A.authored authors_opt
|
|
@ A.predicate A.topics topics_opt in
|
|
let predicate text = List.fold_left (fun a e -> a && e text) true predicates in
|
|
let list_text a (t, fnames) = a ^ Printf.sprintf "%s %s %s 𐄁 %s [%s]\n"
|
|
(Text.short_id t) Date.(pretty_date @@ listing t.Text.date)
|
|
(Person.Set.to_string ~names_only:true t.Text.authors)
|
|
t.Text.title (List.hd fnames)
|
|
in
|
|
print_string @@ match order_opt with
|
|
| false -> FS.fold ~r ~predicate list_text ""
|
|
| true ->
|
|
let order = match reverse_opt with true -> FS.newest | false -> FS.oldest in
|
|
match number_opt with
|
|
| Some number -> FS.fold ~r ~predicate ~order ~number list_text ""
|
|
| None -> FS.fold ~r ~predicate ~order list_text ""
|
|
|
|
open Cmdliner
|
|
let term =
|
|
let recurse = Arg.(value & flag & info ["R"]
|
|
~doc:"recursive, include texts in subdirectories too") in
|
|
let reverse = Arg.(value & flag & info ["r"]
|
|
~doc:"reverse order") in
|
|
let time = Arg.(value & flag & info ["t"]
|
|
~doc:"Sort by time, newest first") in
|
|
let number = Arg.(value & opt (some int) None & info ["n"]
|
|
~docv:"number" ~doc:"number of entries to list") in
|
|
let authed = Arg.(value & opt (some string) None & info ["authored"]
|
|
~docv:"comma-separated names" ~doc:"texts by authors") in
|
|
let topics = Arg.(value & opt (some string) None & info ["topics"]
|
|
~docv:"comma-separated topics" ~doc:"texts with topics") in
|
|
Term.(const listing $ recurse $ time $ reverse $ number $ authed $ topics),
|
|
Term.info "list" ~doc:"list texts" ~man:[ `S "DESCRIPTION";
|
|
`P "List header information for current directory. If -R is used, list header
|
|
information for texts found in subdirectories too, along with their filepaths" ]
|