···561 are intercepted and their stack trace is written to the [err]
562 formatter}
563 {- [help] is the formatter used to print help, version messages
564- or completions, (defaults to {!Format.std_formatter})}
0000565 {- [err] is the formatter used to print error messages
566 (defaults to {!Format.err_formatter}).}} *)
567
···561 are intercepted and their stack trace is written to the [err]
562 formatter}
563 {- [help] is the formatter used to print help, version messages
564+ or completions, (defaults to {!Format.std_formatter}). Note
565+ that the completion protocol needs to output ['\n'] line ending,
566+ if you are outputing to a channel make sure it is in binary
567+ mode to avoid newline translation (this is done automatically
568+ before completion when [help] is {!Format.std_formatter}).}
569 {- [err] is the formatter used to print error messages
570 (defaults to {!Format.err_formatter}).}} *)
571
+2
src/cmdliner_completion.ml
···133 | Opt_name ->
134 `Directives (add_options_group ~err_ppf ~subst eval comp dirs)
135 in
00136 match res with
137 | `Raw raw -> Cmdliner_base.Fmt.pf out_ppf "%s@?" raw
138 | `Directives dirs -> Cmdliner_base.Fmt.pf out_ppf "%a@?" pp_protocol dirs
···133 | Opt_name ->
134 `Directives (add_options_group ~err_ppf ~subst eval comp dirs)
135 in
136+ if out_ppf == Format.std_formatter
137+ then set_binary_mode_out stdout true;
138 match res with
139 | `Raw raw -> Cmdliner_base.Fmt.pf out_ppf "%s@?" raw
140 | `Directives dirs -> Cmdliner_base.Fmt.pf out_ppf "%a@?" pp_protocol dirs