kosuzu/cmd/txt/edit.ml
yakumo.izuru 758d1d6d47 Because sweet girls are the best, officially rebranding Logarion to Kosuzu
Signed-off-by: Izuru Yakumo <yakumo.izuru@chaotic.ninja>

git-svn-id: file:///srv/svn/repo/kosuzu/trunk@73 eb64cd80-c68d-6f47-b6a3-0ada418499da
2024-08-22 16:32:00 +00:00

23 lines
1.2 KiB
OCaml

open Cmdliner
let id = Arg.(value & pos 0 string "" & info [] ~docv: "text ID")
let recurse = Arg.(value & flag & info ["R"] ~doc: "Recurse into subdirectories")
let reverse = Arg.(value & flag & info ["r"] ~doc: "Reverse order")
let time = Arg.(value & flag & info ["t"] ~doc: "Sort by time, newest first")
let number = Arg.(value & opt (some int) None & info ["n"] ~docv: "number" ~doc: "Number of entries to list")
let authed = Arg.(value & opt (some string) None & info ["authored"] ~docv: "Comma-separated names" ~doc: "Texts by authors")
let topics = Arg.(value & opt (some string) None & info ["topics"] ~docv: "Comma-separated topics" ~doc: "Texts by topics")
let edit_t = Term.(const (Kosuzu.Archive.apply_sys_util "EDITOR" "nano") $ recurse $ time $ reverse $ number $ authed $ topics $ id)
let cmd =
let doc = "Edit a text" in
let man = [
`S Manpage.s_description;
`P "Launches EDITOR (nano if environment variable is unset) with text path as parameter.";
`P "If -R is used, the ID search space includes texts found in subdirectories, too.";
`S Manpage.s_environment;
`P "EDITOR - Default editor name" ]
in
let info = Cmd.info "edit" ~doc ~man in
Cmd.v info edit_t