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

Last change on this file since 67 was 66, checked in by Izuru Yakumo, 8 months ago

Migrate the codebase to the latest revision of Cmdliner

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 919 bytes
Line 
1open Logarion
2let file files =
3 let dirs, files = File_store.split_filetypes files in
4 let _link_as_named dir file = Unix.link file (Filename.concat dir file) in
5 let link_with_id dir file =
6 match File_store.to_text file with Error s -> prerr_endline s
7 | Ok t -> Unix.link file (Filename.concat dir (Text.short_id t^".txt")) in
8 let link = link_with_id in
9 List.iter (fun d -> List.iter (link d) files) dirs
10
11open Cmdliner
12let files = Arg.(value & pos_all string [] & info [] ~docv: "Text filenames and subdirectories")
13let file_t = Term.(const file $ files)
14
15let 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
Note: See TracBrowser for help on using the repository browser.