Revision f6907eb4
Added by Scott Ullrich over 15 years ago
usr/local/sbin/pfSsh.php | ||
---|---|---|
154 | 154 |
$pkg_interface='console'; |
155 | 155 |
|
156 | 156 |
$shell_active = true; |
157 |
$tccommands = array(); |
|
158 |
|
|
159 |
function completion($string, $index) { |
|
160 |
global $tccommands; |
|
161 |
return $tccommands; |
|
162 |
} |
|
163 |
|
|
164 |
readline_completion_function("completion"); |
|
157 | 165 |
|
158 | 166 |
if($argc < 2) { |
159 | 167 |
echo "Welcome to the {$g['product_name']} php shell system\n"; |
... | ... | |
161 | 169 |
echo "\nType \"help\" to show common usage scenarios.\n"; |
162 | 170 |
echo "\nAvailable playback commands:\n "; |
163 | 171 |
$files = scandir("/etc/phpshellsessions/"); |
172 |
$tccommands[] = "playback"; |
|
164 | 173 |
foreach($files as $file) { |
165 |
if($file <> "." and $file <> "..") |
|
174 |
if($file <> "." and $file <> "..") {
|
|
166 | 175 |
echo $file . " "; |
176 |
if(function_exists("readline_add_history")) { |
|
177 |
readline_add_history("playback $file"); |
|
178 |
$tccommands[] = "$file"; |
|
179 |
} |
|
180 |
} |
|
167 | 181 |
} |
168 | 182 |
echo "\n\n"; |
169 | 183 |
} |
... | ... | |
181 | 195 |
exit; |
182 | 196 |
} |
183 | 197 |
|
198 |
// Define more commands |
|
199 |
$tccommands[] = "exit"; |
|
200 |
$tccommands[] = "quit"; |
|
201 |
$tccommands[] = "?"; |
|
202 |
$tccommands[] = "exec"; |
|
203 |
$tccommands[] = "startrecording"; |
|
204 |
$tccommands[] = "stoprecording"; |
|
205 |
$tccommands[] = "showrecordings"; |
|
206 |
$tccommands[] = "record"; |
|
207 |
$tccommands[] = "reset"; |
|
208 |
|
|
184 | 209 |
while($shell_active == true) { |
185 | 210 |
$command = readline("{$g['product_name']} shell: "); |
186 | 211 |
readline_add_history($command); |
Also available in: Unified diff
Add tab completion