Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add command system to readme. Add commands to autocomplete list.

  • Loading branch information...
commit 036d6547d350b1e38a0f2ce8e6558944eb0dceea 1 parent f2223e6
Alan Pinstein authored
Showing with 16 additions and 2 deletions.
  1. +8 −0 README.markdown
  2. +8 −2 iphp.php
View
8 README.markdown
@@ -8,6 +8,7 @@ iphp is an interactive php shell that solves a number of painful problems with n
* support ctags *tags* files
* implemented as a class for integration with your framework
* support for require/include; you can load php files within iphp
+* extensible command system
Example:
@@ -21,3 +22,10 @@ Example:
php> $_[0] + 1
=> 2
+
+ php> \help
+ alias(es) <help>
+ -------------------------------------------------------
+ exit,die,bye,quit No help available.
+ reload Re-initialize the iphp state so it's just as if you quit and re-started.
+ help,? No help available.
View
10 iphp.php
@@ -47,10 +47,10 @@ public function initialize($options = array())
{
$this->initializeOptions($options);
$this->initializeTempFiles();
- $this->initializeAutocompletion();
- $this->initializeTags();
$this->initializeRequires();
$this->initializeCommands();
+ $this->initializeAutocompletion();
+ $this->initializeTags();
}
public function options()
{
@@ -60,6 +60,7 @@ public function printHelp()
{
$pad = 30;
print str_pad('alias(es)', $pad, ' ', STR_PAD_RIGHT) . "<help>\n";
+ print str_repeat('-', $pad * 3) . "\n";
foreach (array_unique($this->internalCommands, SORT_REGULAR) as $name => $command) {
$aliases = $command->name();
if (!is_array($aliases))
@@ -102,6 +103,7 @@ private function initializeAutocompletion()
$this->autocompleteList = array_merge($this->autocompleteList, get_defined_constants());
$this->autocompleteList = array_merge($this->autocompleteList, get_declared_classes());
$this->autocompleteList = array_merge($this->autocompleteList, get_declared_interfaces());
+ $this->autocompleteList = array_merge($this->autocompleteList, array_keys($this->internalCommands));
}
private function initializeTags()
@@ -187,6 +189,7 @@ public function getPromptHeader()
- autocomplete (tab key)
- readline support w/history
- require/include support
+- extensible command system
Enter a php statement at the prompt, and it will be evaluated. The variable \$_ will contain the result.
@@ -202,6 +205,9 @@ public function getPromptHeader()
{$this->inputPrompt}\$_[0] + 1
{$this->outputPrompt}2
+To call an internal command, prefix the command with the \\ character.
+{$this->inputPrompt}\\help
+
END;
}
Please sign in to comment.
Something went wrong with that request. Please try again.