Skip to content

Commit

Permalink
Add command system to readme. Add commands to autocomplete list.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Pinstein authored and Alan Pinstein committed Dec 12, 2009
1 parent f2223e6 commit 036d654
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.markdown
Expand Up @@ -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:

Expand All @@ -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.
10 changes: 8 additions & 2 deletions iphp.php
Expand Up @@ -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()
{
Expand All @@ -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))
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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.
Expand All @@ -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;
}
Expand Down

0 comments on commit 036d654

Please sign in to comment.