source: code/trunk/cli/new.ml@ 25

Last change on this file since 25 was 3, checked in by fox, 3 years ago
  • Removed 'txt init'

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
File size: 1.1 KB
Line 
1open Logarion
2open Cmdliner
3
4let new_txt title topics_opt interactive =
5 let t = match title with "" -> "Draft" | _ -> title in
6 let authors = Person.Set.of_string (Sys.getenv "USER") in
7 let text = { (Text.blank ()) with title = t; authors } in
8 let text = try Text.with_str_set text "Topics" (Option.get topics_opt)
9 with _ -> text in
10 match File_store.with_text text with
11 | Error s -> prerr_endline s
12 | Ok (filepath, _note) ->
13 if not interactive then print_endline filepath
14 else
15 (print_endline @@ "Created: " ^ filepath;
16 Sys.command ("$EDITOR " ^ filepath) |> ignore)
17
18let term =
19 let title = Arg.(value & pos 0 string "" & info []
20 ~docv:"title" ~doc:"Title for new article") in
21 let topics= Arg.(value & opt (some string) None & info ["t"; "topics"]
22 ~docv:"comma-separated topics" ~doc:"Topics for new article") in
23 let inter = Arg.(value & flag & info ["i"; "interactive"]
24 ~doc:"Prompts through the steps of creation") in
25 Term.(const new_txt $ title $ topics $ inter), Term.info "new"
26 ~doc:"create a new article" ~man:[ `S "DESCRIPTION";
27 `P "Create a new article, with title 'Draft' when none provided"]
Note: See TracBrowser for help on using the repository browser.