Changeset 36 in code for trunk


Ignore:
Timestamp:
Nov 25, 2022, 4:27:51 PM (2 years ago)
Author:
fox
Message:

txt.conf wizard

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cli/publish.ml

    r27 r36  
    66        ["htm,atom", "public_html/"; "gmi,gmi-atom", "public_gemini/"; "", "public_gopher/"]
    77
     8let wizard () =
     9        print_endline "No txt.conf found. It's required for the repository name & id. Create one? (y/N)";
     10        match input_line stdin with
     11        |"y"->
     12                let title =
     13                        print_endline "Title for repository: ";
     14                        input_line stdin in
     15                let authors =
     16                        print_endline "Authors (format: name <name@email> <http://website>): ";
     17                        input_line stdin in
     18                Logarion.File_store.file "txt.conf"
     19                        (Printf.sprintf "Id: %s\nTitle: %s\nAuthors: %s\n" (Logarion.Id.generate ()) title authors);
     20                Logarion.File_store.of_kv_file ()
     21        | _ -> print_endline "Create a txt.conf and run publish again"; exit 1
     22
    823open Logarion
    924let publish pubdir ids =
    10         let kv = Logarion.File_store.of_kv_file () in
     25        let kv =
     26                match Logarion.File_store.of_kv_file ()
     27                with x when x = Logarion.Store.KV.empty -> wizard () | x -> x in
    1128        let predicate t = List.mem t.Text.id ids in
    1229        let pubdir_source, pubdir = match pubdir with Some d -> "--pubdir ", d | None ->
     
    1633        let targets = targets pubdir in
    1734        if targets = [] then
    18                 Printf.eprintf "No target directories in %s='%s'\n" pubdir_source pubdir
     35                Printf.eprintf "No target directories in %s='%s' (for example %s)\n"
     36                        pubdir_source pubdir (Filename.concat pubdir "public_html")
    1937        else begin
    2038                let pub_dirs = List.map (fun x -> snd x) targets in
Note: See TracChangeset for help on using the changeset viewer.