source: code/trunk/cli/file.ml@ 3

Last change on this file since 3 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.5 KB
Line 
1let split_filetypes files =
2 let acc (dirs, files) x = if Sys.is_directory x
3 then (x::dirs, files) else (dirs, x::files) in
4 List.fold_left acc ([],[]) files
5
6open Logarion
7let file files =
8 let dirs, files = split_filetypes files in
9 let _link_as_named dir file = Unix.link file (Filename.concat dir file) in
10 let link_with_id dir file =
11 match File_store.to_text file with Error s -> prerr_endline s
12 | Ok t -> Unix.link file (Filename.concat dir (Text.short_id t^".txt")) in
13 let link = link_with_id in
14 List.iter (fun d -> List.iter (link d) files) dirs
15
16let unfile files =
17 let dirs, files = split_filetypes files in
18 let unlink dir file = try Unix.unlink (Filename.concat dir file)
19 with Unix.(Unix_error(ENOENT,_,_))-> () in
20 List.iter (fun d -> List.iter (unlink d) files) dirs
21
22open Cmdliner
23let term =
24 let files = Arg.(value & pos_all string [] & info []
25 ~docv:"text filenames and subdirectories") in
26 Term.(const file $ files), Term.info "file"
27 ~doc:"file texts in subdirectories"
28 ~man:[ `S "DESCRIPTION"; `P "Files all texts in parameter in every
29 directory in parameter, using hardlinks.
30
31 Use it to create sub-repositories for sharing or converting" ]
32
33let unfile_term =
34 let files = Arg.(value & pos_all string [] & info []
35 ~docv:"text filenames and subdirectories") in
36 Term.(const unfile $ files), Term.info "unfile"
37 ~doc:"unfile texts from subdirectories"
38 ~man:[ `S "DESCRIPTION"; `P "unfile texts in parameter from
39 directories in parameter, by removing hardlinks" ]
Note: See TracBrowser for help on using the repository browser.