Module B0_ui.Pager
Pager interaction.
Cli arguments
val envs : Cmdliner.Term.env_info listenvsdescribe thePAGERandTERMenvironment variable.
val don't : ?docs:string -> unit -> bool Cmdliner.Term.tdon't ~docs ()is a--no-pagercommand line option to unconditionally request not use a pager.docsis the manual section where the option is documented.
Pager
val find : ?search:B0_std.Fpath.t list -> don't:bool -> unit -> (B0_std.Cmd.t option, string) Stdlib.resultfind ~search ~don'tfinds a suitable pager. This is (in order):Ok Noneifdon'tistrueor if theTERMenvironment variable isdumbor undefined.Ok (Some pager)ifpageris a tool invocation parsed from thePAGERenvironment variable that can be found viaOs.Cmd.find ?search.Ok (Some pager)if eitherlessormorecan be found (in that order) viaOs.Cmd.find ?search.Ok Noneotherwise.
val page_stdout : B0_std.Cmd.t option -> (unit, string) Stdlib.resultpage_stdout pagersetups the program so that ifpagerisSome cmd, the standard output of the program is redirected to a spawn ofcmdwith the following twists:- If the environment variable
LESSis undefined in the current environment it is set toLESS=FRXfor the spawn ofcmd. - A
Pervasive.at_exit function is installed that flushesFmt.stdout andstdout, closesUnix.stdoutand waits upon thecmdspawn termination.
If
pagerisNonethis function has no effect.- If the environment variable
val page_files : B0_std.Cmd.t option -> B0_std.Fpath.t list -> (unit, string) Stdlib.resultpage_files pager fsusespagerto page the filesfs. Ifpageris:None, each of thefsfiles is output on stdout in order separated by a file separator character (U+001C).Some cmd,cmdis run withfsas arguments. Iffsis empty does nothing.