diff options
author | sullrich <sullrich@pfsense.org> | 2009-12-02 21:03:02 -0500 |
---|---|---|
committer | sullrich <sullrich@pfsense.org> | 2009-12-02 21:03:02 -0500 |
commit | f6907eb40b05c6665171c00cfd3e9ba7846a5fb5 (patch) | |
tree | 4117c1a01a3b73819c8817d3ba32c6a23db05c04 | |
parent | 98dfa9e048568508b2e23bd29efbd32515676bd6 (diff) | |
download | pfsense-f6907eb40b05c6665171c00cfd3e9ba7846a5fb5.zip pfsense-f6907eb40b05c6665171c00cfd3e9ba7846a5fb5.tar.gz |
Add tab completion
-rwxr-xr-x | usr/local/sbin/pfSsh.php | 27 |
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); |