December 7, 2016 —John Koster
The history
command can be used to retrieve information about the commands have been previously entered in the Tinker REPL session. By using its various options, you can quickly search and find any history item, replay it and even save it to a file.
The following example session demonstrates how to use the history
command to repeat an expression:
1>>> $user = new App\User;2=> App\User {#645}3>>> history --head 1 --replay4Replaying 1 line of history5--> $user = new App\User;6=> App\User {#648}7>>>
Issuing just the history
command would allow us to view the recently entered commands:
1>>> history20: $user = new App\User;31: history --head 1 --replay42: $user = new App\User;53: history
Like the ls
command, the history
command provides many options to help narrow the search space as well as export options. Issue the ? history
command within a Tinker REPL session to learn more about the history
command options.
∎