let cursors = [| '|'; '/'; '-'; '\\' |] let pos = ref 0 let update_cursor () = if Unix.(isatty stdout) then ( Printf.printf "%c[?25l%c[1D%c[0K%c" (char_of_int 27) (char_of_int 27) (char_of_int 27) (Array.get cursors !pos); pos := (!pos + 1) mod Array.length cursors) let close_cursor () = if Unix.(isatty stdout) then Printf.printf "%c[?25h%c[1D%c[0K\n%!" (char_of_int 27) (char_of_int 27) (char_of_int 27) let clear_line () = if Unix.(isatty stdout) then Printf.printf "%c[2K\r%!" (char_of_int 27)