-
Notifications
You must be signed in to change notification settings - Fork 0
/
console.1.html
221 lines (186 loc) · 11.2 KB
/
console.1.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='content-type' value='text/html;charset=utf8'>
<meta name='generator' value='Ronn/v0.7.3 (http://github.com/rtomayko/ronn/tree/0.7.3)'>
<title>console(1) - A Read-Eval-Print Loop (REPL) for the PHP language.</title>
<style type='text/css' media='all'>
/* style: man */
body#manpage {margin:0}
.mp {max-width:100ex;padding:0 9ex 1ex 4ex}
.mp p,.mp pre,.mp ul,.mp ol,.mp dl {margin:0 0 20px 0}
.mp h2 {margin:10px 0 0 0}
.mp > p,.mp > pre,.mp > ul,.mp > ol,.mp > dl {margin-left:8ex}
.mp h3 {margin:0 0 0 4ex}
.mp dt {margin:0;clear:left}
.mp dt.flush {float:left;width:8ex}
.mp dd {margin:0 0 0 9ex}
.mp h1,.mp h2,.mp h3,.mp h4 {clear:left}
.mp pre {margin-bottom:20px}
.mp pre+h2,.mp pre+h3 {margin-top:22px}
.mp h2+pre,.mp h3+pre {margin-top:5px}
.mp img {display:block;margin:auto}
.mp h1.man-title {display:none}
.mp,.mp code,.mp pre,.mp tt,.mp kbd,.mp samp,.mp h3,.mp h4 {font-family:monospace;font-size:14px;line-height:1.42857142857143}
.mp h2 {font-size:16px;line-height:1.25}
.mp h1 {font-size:20px;line-height:2}
.mp {text-align:justify;background:#fff}
.mp,.mp code,.mp pre,.mp pre code,.mp tt,.mp kbd,.mp samp {color:#131211}
.mp h1,.mp h2,.mp h3,.mp h4 {color:#030201}
.mp u {text-decoration:underline}
.mp code,.mp strong,.mp b {font-weight:bold;color:#131211}
.mp em,.mp var {font-style:italic;color:#232221;text-decoration:none}
.mp a,.mp a:link,.mp a:hover,.mp a code,.mp a pre,.mp a tt,.mp a kbd,.mp a samp {color:#0000ff}
.mp b.man-ref {font-weight:normal;color:#434241}
.mp pre {padding:0 4ex}
.mp pre code {font-weight:normal;color:#434241}
.mp h2+pre,h3+pre {padding-left:0}
ol.man-decor,ol.man-decor li {margin:3px 0 10px 0;padding:0;float:left;width:33%;list-style-type:none;text-transform:uppercase;color:#999;letter-spacing:1px}
ol.man-decor {width:100%}
ol.man-decor li.tl {text-align:left}
ol.man-decor li.tc {text-align:center;letter-spacing:4px}
ol.man-decor li.tr {text-align:right;float:right}
</style>
</head>
<!--
The following styles are deprecated and will be removed at some point:
div#man, div#man ol.man, div#man ol.head, div#man ol.man.
The .man-page, .man-decor, .man-head, .man-foot, .man-title, and
.man-navigation should be used instead.
-->
<body id='manpage'>
<div class='mp' id='man'>
<div class='man-navigation' style='display:none'>
<a href="#NAME">NAME</a>
<a href="#SYNOPSIS">SYNOPSIS</a>
<a href="#DESCRIPTION">DESCRIPTION</a>
<a href="#OPTIONS">OPTIONS</a>
<a href="#REPL-COMMANDS">REPL COMMANDS</a>
<a href="#HISTORY-EXPANSION">HISTORY EXPANSION</a>
<a href="#CONFIGURATION">CONFIGURATION</a>
<a href="#FILES">FILES</a>
<a href="#COPYRIGHT">COPYRIGHT</a>
</div>
<ol class='man-decor man-head man head'>
<li class='tl'>console(1)</li>
<li class='tc'></li>
<li class='tr'>console(1)</li>
</ol>
<h2 id="NAME">NAME</h2>
<p class="man-name">
<code>console</code> - <span class="man-whatis">A Read-Eval-Print Loop (REPL) for the PHP language.</span>
</p>
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<p><code>console</code> [<code>-hHqz</code>] [<code>-c</code> <var>color</var>] [<code>-f</code> <var>file</var>] [<code>-i</code> <var>key=val</var>] [<code>-p</code> <var>file</var>]
[<code>-s</code> <var>file</var>] [<code>-v</code> <var>var=val</var>]</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
<p><strong>Console</strong> provides a Read-Eval-Print Loop (REPL) environment for the PHP
language. A REPL is an interactive programming environment. The user enters
PHP statements and expressions which are read, evaluated, and the results
printed. The REPL environment is protected from errors and exceptions,
including PHP fatal and parse errors.</p>
<h2 id="OPTIONS">OPTIONS</h2>
<dl>
<dt class="flush"><code>-A</code></dt><dd>Don't preload tab-completion cache---console starts up a little faster but
tab completion is a little slower.</dd>
<dt><code>-c</code> <var>color</var></dt><dd>Return value print color (default is <code>cyan</code>). Choices are: <code>black</code>, <code>red</code>,
<code>green</code>, <code>yellow</code>, <code>blue</code>, <code>magenta</code>, <code>cyan</code>, <code>white</code>, and <code>none</code>. Bold
colors can be specified as <code>bold-</code><var>color</var>. Specify <code>none</code> to disable
colored output.</dd>
<dt class="flush"><code>-f</code> <var>file</var></dt><dd>Require <var>file</var> before starting REPL.</dd>
<dt class="flush"><code>-h</code></dt><dd>Print usage info and exit.</dd>
<dt class="flush"><code>-H</code></dt><dd>Don't parse <code>.htaccess</code> files at startup.</dd>
<dt><code>-i</code> <var>key=val</var></dt><dd>Set PHP configuration option <var>key</var> to <var>val</var>.</dd>
<dt class="flush"><code>-p</code> <var>file</var></dt><dd>Require <var>file</var> before loading console's classloader.</dd>
<dt class="flush"><code>-q</code></dt><dd>Don't echo the result after evaling each expression.</dd>
<dt class="flush"><code>-s</code> <var>file</var></dt><dd>Run console commands in <var>file</var> before interactive REPL.</dd>
<dt><code>-v</code> <var>var=val</var></dt><dd>Set <var>$var</var> to <var>val</var> globally in REPL environment.</dd>
<dt class="flush"><code>-z</code></dt><dd>Run script files but don't start interactive REPL.</dd>
</dl>
<p> Multiple <code>-f</code>, <code>-i</code>, <code>-p</code>, and <code>-v</code> options may be specified on the same
command line.</p>
<h2 id="REPL-COMMANDS">REPL COMMANDS</h2>
<p>The following commands are available inside the REPL environment:</p>
<dl>
<dt><code>/d</code> <var>thing</var></dt><dd>Get the doc comment for the <var>thing</var>.</dd>
<dt><code>/e</code> [<var>file</var>]</dt><dd>Append session history to <var>file</var> and open in editor. If <var>file</var> is not
specified then the file specified with the <code>-s</code> option will be used.</dd>
<dt class="flush"><code>/f</code> <var>file</var></dt><dd>Load <var>file</var> via php's <code>require()</code>.</dd>
<dt class="flush"><code>/h</code></dt><dd>Print this help info.</dd>
<dt class="flush"><code>/hh</code></dt><dd>Print expression history.</dd>
<dt class="flush"><code>/p</code> <var>expr</var></dt><dd>Toggle echoing the result just for this expression.</dd>
<dt class="flush"><code>/pp</code></dt><dd>Toggle echoing the result of each eval.</dd>
<dt><code>/pager</code> [<var>cmd</var>]</dt><dd>Pipe results through shell command <var>cmd</var> when displaying them. If no <var>cmd</var>
is provided, the current pager command is removed.</dd>
<dt class="flush"><code>/q</code> <var>expr</var></dt><dd>Evaluate <var>expr</var> but don't display the result.</dd>
<dt class="flush"><code>/x</code> <var>expr</var></dt><dd>Evaluate <var>expr</var> and examine result (print full <code>var_export</code> output).</dd>
</dl>
<h2 id="HISTORY-EXPANSION">HISTORY EXPANSION</h2>
<p>Each statement and expression entered into the REPL is assigned a history
number. Expressions and statements previously entered can be referenced by
this number at read-time via history expansion. The following special forms
are expanded:</p>
<dl>
<dt class="flush"><code>$$</code></dt><dd>Expands to the previous statement/expression.</dd>
<dt class="flush"><code>$</code><var>N</var></dt><dd>Expands to the statement/expression corresponding to history number <var>N</var>.</dd>
<dt class="flush"><code>$</code><var>-N</var></dt><dd>Expands to the <var>N</var>th previous statement/expression. (Note that <code>$$</code> is
equivalent to <code>$-1</code>, for example.)</dd>
<dt class="flush"><code>$!</code></dt><dd>Expands to the previous result. (The previous statement or expression is
not re-evaluated.)</dd>
</dl>
<h2 id="CONFIGURATION">CONFIGURATION</h2>
<p>Most of the REPL functionality can be modified or accessed programmatically
via the <code>Console</code> and <code>ConsoleCommand</code> classes.</p>
<dl>
<dt><code>Console::$DEBUG</code></dt><dd>Extra debugging info is printed when this static property is <code>true</code>.</dd>
<dt><code>Console::$PAGER</code></dt><dd>Shell command to pipe results through (e.g. "tee /tmp/foo | more").</dd>
<dt><code>Console::$PS1</code></dt><dd>This public static property controls how the console prompt is presented.
It may contain either a <code>printf(</code>3<code>)</code> style format string or a callback
function. The format string or function should accept 3 arguments: history
number, elapsed time, and memory used. The callback function should return
the string to be used as the prompt.</dd>
<dt><code>Console::$PS2</code></dt><dd>This public static property is a string to be used for the secondary
(continued line) prompt.</dd>
<dt><code>Console::$printers</code></dt><dd>This is an array whose keys are class names and whose values are functions.
When the console displays an object of the given class, the function will
be called with one argument---the class name. The function should return the
string to be printed. If a printer is not found for the object's class, then
the printer for its parent class is used, if one exists, and so on.</dd>
<dt><code>ConsoleCommand::add(</code>string <var>$name</var>, callable <var>$f</var><code>)</code></dt><dd>Add a command to the REPL, accessible via <code>/</code><var>$name</var>. The <var>$f</var> callback
should accept one argument, the rest of the command line, and it should
return a string (which will be evaluated) or nothing.</dd>
<dt><code>ConsoleCommand::doit(</code>string <var>$line</var><code>)</code></dt><dd>Programmatically run the REPL command <var>$line</var>.</dd>
</dl>
<h2 id="FILES">FILES</h2>
<p>Console looks for the php file <code>~/.consolerc.php</code>. If it finds it then that
file is loaded via <code>require_once</code> when the REPL is started. Additionally, the
REPL can be configured via <code>.htaccess</code> files, as usual with the Apache web
server.</p>
<p>The console requires a scratch file <code>~/.console.php.scratch</code> for the pager if
a pager is specified, and a history file <code>~/.console.php.history</code> if expression
history is used.</p>
<h2 id="COPYRIGHT">COPYRIGHT</h2>
<p>Wigwam is Copyright (c) 2012 Micha Niskin</p>
<p>Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:</p>
<p>The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.</p>
<p>THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.</p>
<ol class='man-decor man-foot man foot'>
<li class='tl'></li>
<li class='tc'>March 2013</li>
<li class='tr'>console(1)</li>
</ol>
</div>
</body>
</html>