summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorsullrich <sullrich@pfsense.org>2009-12-02 21:03:02 -0500
committersullrich <sullrich@pfsense.org>2009-12-02 21:03:02 -0500
commitf6907eb40b05c6665171c00cfd3e9ba7846a5fb5 (patch)
tree4117c1a01a3b73819c8817d3ba32c6a23db05c04 /usr
parent98dfa9e048568508b2e23bd29efbd32515676bd6 (diff)
downloadpfsense-f6907eb40b05c6665171c00cfd3e9ba7846a5fb5.zip
pfsense-f6907eb40b05c6665171c00cfd3e9ba7846a5fb5.tar.gz
Add tab completion
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/sbin/pfSsh.php27
1 files changed, 26 insertions, 1 deletions
diff --git a/usr/local/sbin/pfSsh.php b/usr/local/sbin/pfSsh.php
index 1e124bc..957f063 100755
--- a/usr/local/sbin/pfSsh.php
+++ b/usr/local/sbin/pfSsh.php
@@ -154,6 +154,14 @@ echo ".\n\n";
$pkg_interface='console';
$shell_active = true;
+$tccommands = array();
+
+function completion($string, $index) {
+ global $tccommands;
+ return $tccommands;
+}
+
+readline_completion_function("completion");
if($argc < 2) {
echo "Welcome to the {$g['product_name']} php shell system\n";
@@ -161,9 +169,15 @@ if($argc < 2) {
echo "\nType \"help\" to show common usage scenarios.\n";
echo "\nAvailable playback commands:\n ";
$files = scandir("/etc/phpshellsessions/");
+ $tccommands[] = "playback";
foreach($files as $file) {
- if($file <> "." and $file <> "..")
+ if($file <> "." and $file <> "..") {
echo $file . " ";
+ if(function_exists("readline_add_history")) {
+ readline_add_history("playback $file");
+ $tccommands[] = "$file";
+ }
+ }
}
echo "\n\n";
}
@@ -181,6 +195,17 @@ if($argv[1]=="playback" or $argv[1]=="run") {
exit;
}
+// Define more commands
+$tccommands[] = "exit";
+$tccommands[] = "quit";
+$tccommands[] = "?";
+$tccommands[] = "exec";
+$tccommands[] = "startrecording";
+$tccommands[] = "stoprecording";
+$tccommands[] = "showrecordings";
+$tccommands[] = "record";
+$tccommands[] = "reset";
+
while($shell_active == true) {
$command = readline("{$g['product_name']} shell: ");
readline_add_history($command);
OpenPOWER on IntegriCloud