=== modified file 'ppio.ml' --- ppio.ml 2019-04-11 11:08:29 +0000 +++ ppio.ml 2019-04-10 19:36:12 +0000 @@ -19,8 +19,6 @@ do_echo_prompt (); ;; -let pp_string_list l = String.concat ~sep:" " (List.map l (sprintf "%S"));; - let cmd = let open Command.Let_syntax in let flag_const value = @@ -32,6 +30,20 @@ [%map_open let hide = flag "-H" ~aliases:["--hide-newlines"] no_arg ~doc:"Suppress printing codes of the line-terminating sequence" + (* + and lf = flag "-n" no_arg ~doc:"Use \\n as end of line" + |> map ~f:(fun x -> match x with + | true -> Some "\n" + | false -> None) + and cr = flag "-r" no_arg ~doc:"Use \\r as end of line" + and crlf = flag "-D" no_arg ~doc:"Use \\r\\n as end of line" + and eol = flag "-E" (optional string) ~doc:"EOL Set end of line sequence" + and noeol = flag "-N" no_arg ~doc:"Don't recognize end of line sequences" + and nocolor = flag "-c" ~aliases:["--nocolor"; "--no-color"] no_arg + ~doc:"Don't use colors to distinguish input from output" + and colors = flag "-C" ~aliases:["--colors"; "--colours"] (optional string) + ~doc:"COLORS A quad of VT colors for each of input(normal, escape) and out" + *) and endl = choose_one ~if_nothing_chosen:(`Default_to "\n") [ flag "-n" no_arg ~doc:"Use \\n as end of line" |> flag_const "\n"; @@ -54,23 +66,22 @@ |> map ~f:(fun x -> match x with | Some s -> Some (Some s) | None -> None); - ] - and exe = flag "--" escape ~doc:"EXE Command to execute" - and exe2 = anon (sequence ("EXE"%:string)) + ] + and exe = flag "--" escape ~doc:"Command to execute" in fun () -> Out_channel.output_string stdout "Beep boop!\n"; printf "hide: %B\n" hide; printf "endl: %S\n" endl; + (* printf "-c: %B\n" nocolor; *) (match color with | None -> printf "colors: none\n"; | Some s -> printf "colors: %S\n" s; ); - let real_exe = match exe with - | None -> exe2 - | Some l -> l - in - printf "exe: %s\n" (pp_string_list real_exe); + (match exe with + | None -> printf "-\n" + | Some l -> printf "exe: %s\n" (String.concat ~sep:" " l)); + (* (List.map((sprintf "%S") exe))); *) ] ;;