Export user input history from OCaml utop to file
Asked Answered
P

1

6

When I'm using OCaml utop every line of the input and output is printed into the console:

───┬──────────────────────────────────────────────────────────────┬───
   │ Welcome to utop version 2.10.0 (using OCaml version 4.14.0)! │
   └──────────────────────────────────────────────────────────────┘

Type #utop_help for help about using utop.

─( 22:17:51 )─< command 0 >─────────────────────────────{ counter: 0}─
utop # let x = 50;;
val x : int = 50

Is it possible to export each of user inputs and outputs from utop session into specific file?

Preparedness answered 27/1, 2014 at 22:37 Comment(0)
I
3

Your input is saved by default at ~/.utop-history . Isn't that enough for your purpose?

You can also change location and file size by manipulating UTop.history_file_name and other variables.

Itself answered 27/1, 2014 at 23:34 Comment(1)
There are also two utop directives to save a session to a specific file: #utop_stash and #utop_save.Equatorial

© 2022 - 2024 — McMap. All rights reserved.