Legend:
- Unmodified
- Added
- Removed
-
trunk/cli/dune
r17 r25 2 2 (name txt) 3 3 (public_name txt) 4 (modules txt authors convert conversion file index last listing new topics html atom gemini publish pull read recent)4 (modules txt authors convert conversion edit file index last listing new topics html atom gemini publish pull read recent) 5 5 (libraries text_parse.converter text_parse.parsers logarion msgpck curl str cmdliner)) -
trunk/cli/read.ml
r10 r25 1 1 open Logarion 2 module FS = File_store3 module A = Archive4 5 let print r order_opt reverse_opt number_opt authors_opt topics_opt id_opt =6 let predicates = if id_opt <> "" then [ A.ided id_opt ] else []7 @ A.predicate A.authored authors_opt8 @ A.predicate A.topics topics_opt in9 let predicate text = List.fold_left (fun a e -> a && e text) true predicates in10 let pager = try Sys.getenv "PAGER" with Not_found -> "less" in11 let print_text acc (_t, fnames) = Printf.sprintf "%s %s" acc (List.hd fnames) in12 let paths = match order_opt with13 | false -> FS.fold ~r ~predicate print_text ""14 | true ->15 let order = match reverse_opt with true -> FS.newest | false -> FS.oldest in16 match number_opt with17 | Some number -> FS.fold ~r ~predicate ~order ~number print_text ""18 | None -> FS.fold ~r ~predicate ~order print_text ""19 in if paths = "" then ()20 else (ignore @@ Sys.command @@ Printf.sprintf "%s %s" pager paths)21 22 2 23 3 open Cmdliner … … 33 13 let topics = Arg.(value & opt (some string) None & info ["topics"] 34 14 ~docv:"comma-separated topics" ~doc:"texts with topics") in 35 Term.(const print$ recurse $ time $ reverse $ number $ authed $ topics $ id),15 Term.(const (Archive.apply_sys_util "PAGER" "less") $ recurse $ time $ reverse $ number $ authed $ topics $ id), 36 16 Term.info "read" ~doc: "read a text" ~man:[ `S "DESCRIPTION"; 37 17 `P "List header information for current directory. If -R is used, list header -
trunk/cli/txt.ml
r17 r25 4 4 let default_cmd = 5 5 let doc = "Discover, collect & exchange texts" in 6 let man = [ `S "Contact"; `P "<mailto: fox@orbitalfox.eu?subject=Logarion>" ] in6 let man = [ `S "Contact"; `P "<mailto:logarion@lists.tildeverse.org?subject=Logarion>" ] in 7 7 Term.(ret (const (`Help (`Pager, None)))), Term.info "txt" ~version ~doc ~man 8 8 … … 10 10 Authors.term; 11 11 Convert.term; 12 Edit.term; 12 13 File.term; File.unfile_term; 13 14 Index.term;
Note:
See TracChangeset
for help on using the changeset viewer.