- Timestamp:
- Aug 21, 2024, 1:37:05 AM (8 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/cli/authors.ml
r65 r66 7 7 Person.Set.iter (fun x -> print_endline (Person.to_string x)) s 8 8 9 open Ocmd 10 let term = 11 let recurse = Arg.(value & flag & info ["R"] 12 ~doc:"include texts in subdirectories too") in 13 let topics = Arg.(value & opt (some string) None & info ["topics"] 14 ~docv:"TOPICS" ~doc:"display authors who have written on topics") in 15 Term.(const authors $ recurse $ topics), 16 Term.info "authors" ~doc:"list authors" 17 ~man:[ `S "DESCRIPTION"; `P "List author names" ] 9 open Cmdliner 10 let recurse = Arg.(value & flag & info ["R"] ~doc: "Include texts in subdirectories too") 11 let topics = Arg.(value & opt (some string) None & info ["topics"] ~docv:"topics" ~doc: "Display authors who have written on topics") 12 13 let authors_t = Term.(const authors $ recurse $ topics) 14 15 let cmd = 16 let doc = "List authors" in 17 let man = [ 18 `S Manpage.s_description; 19 `P "List author names" ] 20 in 21 let info = Cmd.info "authors" ~version:"%%VERSION%%" ~doc ~man in 22 Cmd.v info authors_t -
trunk/cli/convert.ml
r65 r66 77 77 | path -> Printf.eprintf "Path doesn't exist: %s" path 78 78 79 open Ocmd 80 let term = 81 let path = Arg.(value & pos 0 string "" & info [] ~docv:"path" 82 ~doc:"Text file or directory to convert. If directory is provided, it must contain an index.pck (see: txt index)") in 83 let types = Arg.(value & opt string "all" & info ["t"; "type"] ~docv:"output type" 84 ~doc:"Convert to file type") in 85 let noindex = Arg.(value & flag & info ["noindex"] 86 ~doc:"Don't create indices in target format") in 87 Term.(const at_path $ types $ noindex $ path), 88 Term.info "convert" ~doc:"convert texts" 89 ~man:[ `S "DESCRIPTION"; `P "Convert text or indexed texts within a directory to another format. 90 If path is a directory must contain an index.pck. Run `txt index` first." ] 79 open Cmdliner 80 81 let path = Arg.(value & pos 0 string "" & info [] ~docv:"path" ~doc:"Text file or directory to convert. If directory is provided, it must contain an index.pck (see: txt index)") 82 let types = Arg.(value & opt string "all" & info ["t"; "type"] ~docv:"output type" ~doc:"Convert to file type") 83 let noindex = Arg.(value & flag & info ["noindex"] ~doc:"Don't create indices in target format") 84 85 let convert_t = Term.(const at_path $ types $ noindex $ path) 86 87 let cmd = 88 let doc = "Convert texts" in 89 let man = [ 90 `S Manpage.s_description; 91 `P "Convert text or indexed texts within a directory to another format."; 92 `P "If path is a directory must contain an index.pck."; 93 `P "Run `txt index` first." ] 94 in 95 let info = Cmd.info "convert" ~version: "%%VERSION%%" ~doc ~man in 96 Cmd.v info convert_t -
trunk/cli/dune
r61 r66 3 3 (public_name txt) 4 4 (modules txt authors convert conversion edit file index last listing 5 new topics html atom gemini peers pull read recent )6 (libraries text_parse.converter text_parse.parsers logarion msgpck curl str cmdliner ))5 new topics html atom gemini peers pull read recent unfile) 6 (libraries text_parse.converter text_parse.parsers logarion msgpck curl str cmdliner ocmd)) -
trunk/cli/edit.ml
r65 r66 1 open Ocmd 2 let term = 3 let id = Arg.(value & pos 0 string "" & info [] ~docv:"text ID") in 4 let recurse = Arg.(value & flag & info ["R"] ~doc:"recurse, include subdirs") in 5 let reverse = Arg.(value & flag & info ["r"] ~doc:"reverse order") in 6 let time = Arg.(value & flag & info ["t"] ~doc:"sort by time, newest first") in 7 let number = Arg.(value & opt (some int) None & info ["n"] 8 ~docv:"number" ~doc:"number of entries to list") in 9 let authed = Arg.(value & opt (some string) None & info ["authored"] 10 ~docv:"comma-separated names" ~doc:"texts by authors") in 11 let topics = Arg.(value & opt (some string) None & info ["topics"] 12 ~docv:"comma-separated topics" ~doc:"texts with topics") in 13 Term.(const (Logarion.Archive.apply_sys_util "EDITOR" "nano") $ recurse $ time $ reverse $ number $ authed $ topics $ id), 14 Term.info "edit" ~doc: "edit a text" ~man:[ `S "DESCRIPTION"; 15 `P "Launches EDITOR (nano if environment variable is unset) with text path as parameter. 16 If -R is used, the ID search space includes texts found in subdirectories too" ] 1 open Cmdliner 2 let id = Arg.(value & pos 0 string "" & info [] ~docv: "text ID") 3 let recurse = Arg.(value & flag & info ["R"] ~doc: "Recurse into subdirectories") 4 let reverse = Arg.(value & flag & info ["r"] ~doc: "Reverse order") 5 let time = Arg.(value & flag & info ["t"] ~doc: "Sort by time, newest first") 6 let number = Arg.(value & opt (some int) None & info ["n"] ~docv: "number" ~doc: "Number of entries to list") 7 let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv: "Comma-separated names" ~doc: "Texts by authors") 8 let topics = Arg.(value & opt (some string) None & info ["topics"] ~docv: "Comma-separated topics" ~doc: "Texts by topics") 9 10 let edit_t = Term.(const (Logarion.Archive.apply_sys_util "EDITOR" "nano") $ recurse $ time $ reverse $ number $ authed $ topics $ id) 11 12 let cmd = 13 let doc = "Edit a text" in 14 let man = [ 15 `S Manpage.s_description; 16 `P "Launches EDITOR (nano if environment variable is unset) with text path as parameter."; 17 `P "If -R is used, the ID search space includes texts found in subdirectories, too." ] 18 in 19 let info = Cmd.info "edit" ~version:"%%VERSION%%" ~doc ~man in 20 Cmd.v info edit_t -
trunk/cli/file.ml
r65 r66 9 9 List.iter (fun d -> List.iter (link d) files) dirs 10 10 11 let unfile files = 12 let dirs, files = File_store.split_filetypes files in 13 let unlink dir file = try Unix.unlink (Filename.concat dir file) 14 with Unix.(Unix_error(ENOENT,_,_))-> () in 15 List.iter (fun d -> List.iter (unlink d) files) dirs 11 open Cmdliner 12 let files = Arg.(value & pos_all string [] & info [] ~docv: "Text filenames and subdirectories") 13 let file_t = Term.(const file $ files) 16 14 17 open Ocmd 18 let term = 19 let files = Arg.(value & pos_all string [] & info [] 20 ~docv:"text filenames and subdirectories") in 21 Term.(const file $ files), Term.info "file" 22 ~doc:"file texts in subdirectories" 23 ~man:[ `S "DESCRIPTION"; `P "Files all texts in parameter in every 24 directory in parameter, using hardlinks. 25 26 Use it to create sub-repositories for sharing or converting" ] 27 28 let unfile_term = 29 let files = Arg.(value & pos_all string [] & info [] 30 ~docv:"text filenames and subdirectories") in 31 Term.(const unfile $ files), Term.info "unfile" 32 ~doc:"unfile texts from subdirectories" 33 ~man:[ `S "DESCRIPTION"; `P "unfile texts in parameter from 34 directories in parameter, by removing hardlinks" ] 15 let cmd = 16 let doc = "File texts in subdirectories" in 17 let man = [ 18 `S Manpage.s_description; 19 `P "Files all texts in parameter in every directory in parameter, using hardlinks"; 20 `P "Use it to create sub-repositories for sharing or converting" ] 21 in 22 let info = Cmd.info "file" ~version:"%%VERSION%%" ~doc ~man in 23 Cmd.v info file_t -
trunk/cli/index.ml
r65 r66 68 68 index { dir; index_path; pck = Header_pack.of_kv kv } 69 69 70 open Ocmd 71 let term = 72 let print= Arg.(value & flag & info ["print"] ~doc:"print info") in 73 let title= Arg.(value & opt ~vopt:(Some "") (some string) None & info ["t"; "title"] 74 ~docv:"string" ~doc:"Title for index") in 75 let auth = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["a"; "authors"] 76 ~docv:"comma-separated names" ~doc:"Index authors") in 77 let locs = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["l"; "locations"] 78 ~docv:"comma-separated URLs" ~doc:"repository URLs") in 79 let peers= Arg.(value & opt ~vopt:(Some "") (some string) None & info ["p"; "peers"] 80 ~docv:"comma-separated URLs" ~doc:"URLs to other known text repositories") in 81 let dir = Arg.(value & pos 0 string "." & info [] 82 ~docv:"directory to index") in 83 let doc = "Generate an index.pck for texts in a directory" in 84 Term.(const load $ dir $ print $ title $ auth $ locs $ peers), 85 Term.info "index" ~doc 86 ~man:[ `S "DESCRIPTION"; `Pre "An index contains:\n 87 * an info section with: title for the index, the authors, locations (URLs) the texts can be access\n 88 * listing of texts with: ID, date, title, authors, topics\n 89 * list of other text repositories (peers)\n\n 90 MessagePack format. <msgpack.org>" ] 70 open Cmdliner 71 let print = Arg.(value & flag & info ["print"] ~doc: "Print info") 72 let title = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["t"; "title"] ~docv: "string" ~doc: "Title for index") 73 let auth = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["a"; "authors"] ~docv: "Comma-separated names" ~doc: "Index authors") 74 let locs = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["l"; "location"] ~docv: "Comma-separated URLs" ~doc: "Repository URLs") 75 let peers = Arg.(value & opt ~vopt:(Some "") (some string) None & info ["p"; "peers"] ~docv: "Comma-separated URLs" ~doc: "URLs to other known text repositories") 76 let dir = Arg.(value & pos 0 string "." & info [] ~docv: "Directory to index") 91 77 78 let index_t = Term.(const load $ dir $ print $ title $ auth $ locs $ peers) 79 80 let cmd = 81 let doc = "Generate an index.pck for texts in a directory" in 82 let man = [ 83 `S Manpage.s_description; 84 `P "An index contains:\n"; 85 `P "* n info section with: title for the index, the authors, locations (URLs) the texts can be accessed."; 86 `P "* listing of texts with: ID, date, title, authors, topics."; 87 `P "* list of other text repositories (peers)"; 88 `S Manpage.s_see_also; 89 `P "MessagePack format. https://msgpack.org" ] in 90 let info = Cmd.info "index" ~version:"%%VERSION%%" ~doc ~man in 91 Cmd.v info index_t -
trunk/cli/last.ml
r65 r66 21 21 | Some (_, f) -> List.iter print_endline f 22 22 23 open Ocmd 24 let term = 25 let mine = Arg.(value & flag & info ["mine"] ~doc:"last text authored by me") in 26 Term.(const last $ mine), 27 Term.info "last" ~doc:"most recent text" 28 ~man:[ `S "DESCRIPTION"; `P "Print the filename of most recent text" ] 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" ~version:"%%VERSION%%" ~doc ~man in 35 Cmd.v info last_t -
trunk/cli/listing.ml
r65 r66 20 20 | None -> FS.iter ~r ~dir ~predicate ~order list_text 21 21 22 open Ocmd 23 let term = 24 let recurse = Arg.(value & flag & info ["R"] ~doc:"recurse, include subdirs") in 25 let reverse = Arg.(value & flag & info ["r"] ~doc:"reverse order") in 26 let time = Arg.(value & flag & info ["t"] ~doc:"sort by time, newest first") in 27 let paths = Arg.(value & flag & info ["p"] ~doc:"show file paths") in 28 let number = Arg.(value & opt (some int) None & info ["n"] 29 ~docv:"number" ~doc:"number of entries to list") in 30 let authed = Arg.(value & opt (some string) None & info ["authored"] 31 ~docv:"comma-separated names" ~doc:"texts by authors") in 32 let topics = Arg.(value & opt (some string) None & info ["topics"] 33 ~docv:"comma-separated topics" ~doc:"texts with topics") in 34 let dir = Arg.(value & pos 0 string "" & info [] 35 ~docv:"directory to index") in 36 Term.(const listing $ recurse $ time $ reverse $ number $ paths $ authed $ topics $ dir), 37 Term.info "list" ~doc:"list texts" ~man:[ `S "DESCRIPTION"; 38 `P "Diplays text id, date, author, title for a directory. 39 If directory argument is ommitted, TXTDIR is used, where empty value defaults to ~/.local/share/texts. 40 If -R is used, list header information for texts found in subdirectories too." ] 22 open Cmdliner 23 24 let recurse = Arg.(value & flag & info ["R"] ~doc: "Recurse into subdirectories") 25 let reverse = Arg.(value & flag & info ["r"] ~doc: "Reverse order") 26 let time = Arg.(value & flag & info ["t"] ~doc: "Sort by time, newest first") 27 let paths = Arg.(value & flag & info ["p"] ~doc: "Show file paths") 28 let number = Arg.(value & opt (some int) None & info ["n"] ~docv: "number" ~doc: "Number of entries to list") 29 let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv: "comma-separated names" ~doc: "Texts by authors") 30 let topics = Arg.(value & opt (some string) None & info ["topics"] ~docv: "comma-separated topics" ~doc: "Texts by topics") 31 let dir = Arg.(value & pos 0 string "" & info [] ~docv: "directory to index") 32 33 let listing_t = Term.(const listing $ recurse $ time $ reverse $ number $ paths $ authed $ topics $ dir) 34 35 let cmd = 36 let doc = "List texts" in 37 let man = [ 38 `S Manpage.s_description; 39 `P "Displays text id, date, author, title for a directory."; 40 `P "If directory argument is omitted, TXTDIR is used, where empty value defaults to ~/.local/share/texts."; 41 `P "If -R is used, list header information for texts found in subdirectories, too." ] 42 in 43 let info = Cmd.info "list" ~version:"%%VERSION%%" ~doc ~man in 44 Cmd.v info listing_t -
trunk/cli/new.ml
r65 r66 1 1 open Logarion 2 open Ocmd2 open Cmdliner 3 3 4 4 let new_txt title topics_opt interactive = … … 14 14 print_endline filepath 15 15 16 let term = 17 let title = Arg.(value & pos 0 string "" & info [] 18 ~docv:"title" ~doc:"Title for new article") in 19 let topics= Arg.(value & opt (some string) None & info ["t"; "topics"] 20 ~docv:"comma-separated topics" ~doc:"Topics for new article") in 21 let inter = Arg.(value & flag & info ["i"; "interactive"] 22 ~doc:"Prompts through the steps of creation") in 23 Term.(const new_txt $ title $ topics $ inter), Term.info "new" 24 ~doc:"create a new article" ~man:[ `S "DESCRIPTION"; 25 `P "Create a new article, with title 'Draft' when none provided"] 16 let title = Arg.(value & pos 0 string "" & info [] ~docv: "title" ~doc: "Title for new article") 17 let topics = Arg.(value & opt (some string) None & info ["t"; "topics"] ~docv: "Comma-separated topics" ~doc: "Topics for new article") 18 let inter = Arg.(value & flag & info ["i"; "interactive"] ~doc: "Prompt through the steps of creation") 19 20 let new_t = Term.(const new_txt $ title $ topics $ inter) 21 22 let cmd = 23 let doc = "Create a new article" in 24 let man = [ 25 `S Manpage.s_description; 26 `P "Create a new article, with title 'Draft' when none provided" ] 27 in 28 let info = Cmd.info "new" ~version:"%%VERSION%%" ~doc ~man in 29 Cmd.v info new_t -
trunk/cli/peers.ml
r65 r66 29 29 Logarion.Peers.fold print_peer () 30 30 31 open Ocmd 32 let term = 33 let remove = Arg.(value & opt (some string) None & info ["remove"] 34 ~docv:"repository ID" ~doc:"remove repository texts & from future pulling") in 35 Term.(const peers $ remove), 36 Term.info "peers" ~doc:"list current peers" ~man:[ `S "DESCRIPTION"; 37 `P "Lists current peers and associated information"] 31 open Cmdliner 32 let remove = Arg.(value & opt (some string) None & info ["remove"] ~docv:"Repository ID" ~doc:"Remove repository texts and from future pulling") 33 let peers_t = Term.(const peers $ remove) 34 35 let cmd = 36 let doc = "List current peers" in 37 let man = [ 38 `S Manpage.s_description; 39 `P "List current peers and associated information" ] 40 in 41 let info = Cmd.info "peers" ~version:"%%VERSION%%" ~doc ~man in 42 Cmd.v info peers_t -
trunk/cli/pull.ml
r65 r66 139 139 | "" -> pull_list auths topics | x -> ignore (pull_index x auths topics) 140 140 141 open Ocmd 142 let term = 143 let authors = Arg.(value & opt (some string) None & info ["a"; "authors"] 144 ~docv:"comma-separated names" ~doc:"filter by authors") in 145 let topics = Arg.(value & opt (some string) None & info ["t"; "topics"] 146 ~docv:"comma-separated topics" ~doc:"filter by topics") in 147 let url = Arg.(value & pos 0 string "" & info [] ~docv:"URL" 148 ~doc:"Repository location") in 149 Term.(const pull $ url $ authors $ topics), 150 Term.info "pull" ~doc:"pull listed texts" ~man:[ `S "DESCRIPTION"; 151 `P "Pull texts from known repositories. To add a new repository use:"; 152 `P "txt pull [url]"; 153 `P ("This creates a directory in " ^ Logarion.Peers.text_dir 154 ^ " and downloads the text index.pck file in it")] 141 open Cmdliner 142 let authors = Arg.(value & opt (some string) None & info ["a"; "authors"] ~docv:"Comma-separated names" ~doc:"Filter by authors") 143 let topics = Arg.(value & opt (some string) None & info ["t"; "topics"] ~docv:"Comma-separated topics" ~doc:"Filter by topics") 144 let url = Arg.(value & pos 0 string "" & info [] ~docv:"URL" ~doc:"Repository location") 155 145 156 (*module Msg = struct*) 157 (* type t = string * string*) 158 (* let compare (x0,y0) (x1,y1) =*) 159 (* match compare x1 x0 with 0 -> String.compare y0 y1 | c -> c*) 160 (*end*) 161 (*module MsgSet = Set.Make(Msg)*) 162 (*let pull_msgs url _authors _topics =*) 163 (* match http_apply response url with*) 164 (* | Error msg ->*) 165 (* Printf.eprintf "Failed index request for %s %s" url msg*) 166 (* | Ok body ->*) 167 (* let rec fold_msgs s a fn =*) 168 (* let t, msg = Scanf.bscanf s "%s %s@\n" (fun t m -> t, m) in*) 169 (* if t <> "" then fold_msgs s (fn a t msg) fn else a*) 170 (* in*) 171 (* let s = Scanf.Scanning.from_string body in*) 172 (* let msgs = MsgSet.empty in*) 173 (* let date_string t = Ptime.to_date t |>*) 174 (* fun (y, m, d) -> Printf.sprintf "%04d-%02d-%02d" y m d in*) 175 (* let msgs = fold_msgs s msgs*) 176 (* (fun msgs t m -> match Ptime.of_rfc3339 t with*) 177 (* | Ok (v,_,_) -> let open MsgSet in*) 178 (* let msgs = if cardinal msgs > 1 then remove (max_elt msgs) msgs else msgs in*) 179 (* add (v,m) msgs*) 180 (* | _ -> msgs) in*) 181 (* let msg_string = MsgSet.fold*) 182 (* (fun (t,m) a -> a ^ Printf.sprintf " %s 𐄁 %s\n" (date_string t) m)*) 183 (* msgs "" in*) 184 (* Printf.printf "┌───{ %s }───┐\n%s" url msg_string*) 146 let pull_t = Term.(const pull $ url $ authors $ topics) 147 148 let cmd = 149 let doc = "Pull listed texts" in 150 let man = [ 151 `S Manpage.s_description; 152 `P "Pull texts from known repositories." ] 153 in 154 let info = Cmd.info "pull" ~version:"%%VERSION%%" ~doc ~man in 155 Cmd.v info pull_t -
trunk/cli/read.ml
r65 r66 1 1 open Logarion 2 2 3 open Ocmd 4 let term = 5 let id = Arg.(value & pos 0 string "" & info [] ~docv:"text ID") in 6 let recurse = Arg.(value & flag & info ["R"] ~doc:"recurse, include subdirs") in 7 let reverse = Arg.(value & flag & info ["r"] ~doc:"reverse order") in 8 let time = Arg.(value & flag & info ["t"] ~doc:"sort by time, newest first") in 9 let number = Arg.(value & opt (some int) None & info ["n"] 10 ~docv:"number" ~doc:"number of entries to list") in 11 let authed = Arg.(value & opt (some string) None & info ["authored"] 12 ~docv:"comma-separated names" ~doc:"texts by authors") in 13 let topics = Arg.(value & opt (some string) None & info ["topics"] 14 ~docv:"comma-separated topics" ~doc:"texts with topics") in 15 Term.(const (Archive.apply_sys_util "PAGER" "less") $ recurse $ time $ reverse $ number $ authed $ topics $ id), 16 Term.info "read" ~doc: "read a text" ~man:[ `S "DESCRIPTION"; 17 `P "List header information for current directory. If -R is used, list header 18 information for texts found in subdirectories too, along with their filepaths" ] 3 open Cmdliner 4 5 6 let id = Arg.(value & pos 0 string "" & info [] ~docv:"text ID") 7 let recurse = Arg.(value & flag & info ["R"] ~doc:"recurse, include subdirs") 8 let reverse = Arg.(value & flag & info ["r"] ~doc:"reverse order") 9 let time = Arg.(value & flag & info ["t"] ~doc:"sort by time, newest first") 10 let number = Arg.(value & opt (some int) None & info ["n"] ~docv:"number" ~doc:"number of entries to list") 11 let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv:"comma-separated names" ~doc:"texts by authors") 12 let topics = Arg.(value & opt (some string) None & info ["topics"] ~docv:"comma-separated topics" ~doc:"texts with topics") 13 14 let read_t = Term.(const (Archive.apply_sys_util "PAGER" "less") $ recurse $ time $ reverse $ number $ authed $ topics $ id) 15 16 let cmd = 17 let doc = "Read a text" in 18 let man = [ 19 `S Manpage.s_description; 20 `P "Deprecated. This subcommand will be removed in a future release of Logarion"; 21 `P "This invokes the PAGER utility ('less' if unset) on an article of the archive" ] 22 in 23 let info = Cmd.info "read" ~version:"%%VERSION%%" ~doc ~man in 24 Cmd.v info read_t -
trunk/cli/recent.ml
r65 r66 3 3 module A = Archive 4 4 5 open Ocmd 6 let term = 7 let recurse = Arg.(value & flag & info ["R"] ~doc:"recurse, include subdirs") in 8 let reverse = Arg.(value & flag & info ["r"] ~doc:"reverse order") in 9 let paths = Arg.(value & flag & info ["p"] ~doc:"show file paths") in 10 let number = Arg.(value & opt (some int) (Some 10) & info ["n"] 11 ~docv:"number" ~doc:"number of entries to list") in 12 let authed = Arg.(value & opt (some string) None & info ["authored"] 13 ~docv:"comma-separated names" ~doc:"texts by authors") in 14 let topics = Arg.(value & opt (some string) None & info ["topics"] 15 ~docv:"comma-separated topics" ~doc:"texts with topics") in 16 let dir = Arg.(value & pos 0 string "" & info [] 17 ~docv:"directory to index") in 18 Term.(const Listing.listing $ recurse $ (const true) $ reverse $ number $ paths $ authed $ topics $ dir), 19 Term.info "recent" ~doc:"list recent texts" ~man:[ `S "DESCRIPTION"; 20 `P "List header information of most recent texts. If -R is used, list header 21 information for texts found in subdirectories too, along with their filepaths" ] 5 open Cmdliner 6 let recurse = Arg.(value & flag & info ["R"] ~doc: "Recurse into subdirectories") 7 let reverse = Arg.(value & flag & info ["r"] ~doc: "Reverse order") 8 let paths = Arg.(value & flag & info ["p"] ~doc: "Show file paths") 9 let number = Arg.(value & opt (some int) (Some 10) & info ["n"] ~docv: "number" ~doc: "Number of entries to list") 10 let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv: "Comma-separated names" ~doc: "Texts by authors") 11 let topics = Arg.(value & opt (some string) None & info ["topics"] ~docv: "Comma-separated topics" ~doc: "Texts with topics") 12 let dir = Arg.(value & pos 0 string "" & info [] ~docv: "Directory to index") 13 14 let recent_t = Term.(const Listing.listing $ recurse $ (const true) $ reverse $ number $ paths $ authed $ topics $ dir) 15 let cmd = 16 let doc = "List recent texts" in 17 let man = [ 18 `S Manpage.s_description; 19 `P "List header information of most recent texts."; 20 `P "If -R is used, list header information for texts found in subdirectories, too, along with their filepaths" ] 21 in 22 let info = Cmd.info "recent" ~version:"%%VERSION%%" ~doc ~man in 23 Cmd.v info recent_t -
trunk/cli/topics.ml
r65 r66 7 7 print_endline @@ String_set.to_string s 8 8 9 open Ocmd 10 let term = 11 let recurse = Arg.(value & flag & info ["R"] 12 ~doc:"include texts in subdirectories") in 13 let authed = Arg.(value & opt (some string) None & info ["authored"] 14 ~docv:"comma-separated authors" ~doc:"topics by authors") in 15 Term.(const topics $ recurse $ authed), 16 Term.info "topics" ~doc:"list topics" ~man:[ `S "DESCRIPTION"; 17 `P "List of topics" ] 9 open Cmdliner 10 let recurse = Arg.(value & flag & info ["R"] ~doc: "Include texts in subdirectories") 11 let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv: "Comma-separated authors" ~doc: "Topics by authors") 12 let topics_t = Term.(const topics $ recurse $ authed) 13 14 let cmd = 15 let doc = "List topics" in 16 let man = [ 17 `S Manpage.s_description; 18 `P "List of topics" ] 19 in 20 let info = Cmd.info "topics" ~version:"%%VERSION%%" ~doc ~man in 21 Cmd.v info topics_t -
trunk/cli/txt.ml
r65 r66 1 open Ocmd 2 let default_cmd = 3 let doc = "Discover, collect & exchange texts" in 4 let man = [ `S "CONTACT"; `P "<mailto:logarion-dev@chaotic.ninja>" ] in 5 Term.(ret (const (`Help (`Pager, None)))), Term.info "txt" ~version:"%%VERSION%%" ~doc ~man 1 open Cmdliner 6 2 7 let () = match Term.eval_choice default_cmd [ 8 Authors.term; 9 Convert.term; 10 Edit.term; 11 File.term; File.unfile_term; 12 Index.term; 13 Last.term; 14 Listing.term; 15 New.term; 16 Peers.term; 17 Pull.term; 18 Read.term; 19 Recent.term; 20 Topics.term; 21 ] with `Error _ -> exit 1 | _ -> exit 0 3 let subs = [ 4 Authors.cmd; (* Done *) 5 Convert.cmd; (* Done *) 6 Edit.cmd; (* Done *) 7 File.cmd; (* Done *) 8 Index.cmd; (* Done *) 9 Last.cmd; (* Done *) 10 Listing.cmd; (* Done *) 11 New.cmd; (* Done *) 12 Peers.cmd; (* Done *) 13 Pull.cmd; (* Done *) 14 Read.cmd; (* Done *) 15 Recent.cmd; (* Done *) 16 Topics.cmd; (* Done *) 17 Unfile.cmd; (* Done *) 18 ] 19 20 let default_cmd = Term.(ret (const (`Help (`Pager, None)))) 21 22 let txt = 23 let doc = "Discover, collect and exchange texts" in 24 let man = [ 25 `S "CONTACT"; 26 `P "<mailto:logarion-dev@chaotic.ninja>"; ] 27 in 28 Cmd.group (Cmd.info "txt" ~version:"%%VERSION%%" ~doc ~man) ~default:default_cmd subs 29 30 let main () = exit (Cmd.eval txt) 31 let () = main () -
trunk/logarion.opam
r65 r66 1 1 # This file is generated by dune, edit dune-project instead 2 2 opam-version: "2.0" 3 version: "1. 3.2"3 version: "1.4.0" 4 4 synopsis: "Texts archival and exchange" 5 5 maintainer: ["Izuru Yakumo <yakumo.izuru@chaotic.ninja>"] … … 8 8 homepage: "https://suzunaan.chaotic.ninja/logarion/" 9 9 bug-reports: "mailto:logarion-dev@chaotic.ninja" 10 depends: ["ocaml" "dune" "ocurl" "msgpck" " ocmd"]10 depends: ["ocaml" "dune" "ocurl" "msgpck" "cmdliner"] 11 11 build: [ 12 12 ["dune" "subst"] {pinned}
Note:
See TracChangeset
for help on using the changeset viewer.