Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
ec60970b5d | |||
7c76928c3b |
@ -90,6 +90,16 @@ class Shell
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the current context
|
||||||
|
*
|
||||||
|
* @return Context The current context
|
||||||
|
*/
|
||||||
|
public function getContext()
|
||||||
|
{
|
||||||
|
return $this->context;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Push a new primary context, saving the previous contexts on a stack.
|
* Push a new primary context, saving the previous contexts on a stack.
|
||||||
*
|
*
|
||||||
@ -408,7 +418,7 @@ class Shell
|
|||||||
}
|
}
|
||||||
ksort($ghelp);
|
ksort($ghelp);
|
||||||
$_ = function($command,$args,$info) {
|
$_ = function($command,$args,$info) {
|
||||||
printf(" \e[97m%s\e[0m \e[90;3m%s\e[0m - \e[36m%s\e[0m\n", $command, $args, $info);
|
printf(" \e[96m%s\e[0m \e[0;3m%s\e[0m \e[30G\e[36m%s\e[0m\n", $command, $args, $info);
|
||||||
};
|
};
|
||||||
printf("\e[1mCommands:\e[0m\n");
|
printf("\e[1mCommands:\e[0m\n");
|
||||||
foreach ($help as $command=>$info) {
|
foreach ($help as $command=>$info) {
|
||||||
@ -418,13 +428,13 @@ class Shell
|
|||||||
$_($command, $args,$info);
|
$_($command, $args,$info);
|
||||||
}
|
}
|
||||||
if (count($ghelp)) {
|
if (count($ghelp)) {
|
||||||
printf("\n\e[0mCommands from parent contexts:\e[0m\n");
|
printf("\e[1mCommands from parent contexts:\e[0m\n");
|
||||||
if (strpos($command," ")!==false) {
|
if (strpos($command," ")!==false) {
|
||||||
list($command,$args) = explode(" ",$command,2);
|
list($command,$args) = explode(" ",$command,2);
|
||||||
} else $args=null;
|
} else $args=null;
|
||||||
$_($command, $args,$info);
|
$_($command, $args,$info);
|
||||||
}
|
}
|
||||||
printf("\nGlobal commands:\n");
|
printf("\e[1mGlobal commands:\e[0m\n");
|
||||||
$_("exit", null, "Leave the shell");
|
$_("exit", null, "Leave the shell");
|
||||||
$_(".", null, "Show the context tree");
|
$_(".", null, "Show the context tree");
|
||||||
$_("..", null, "Discard the current context and go to parent");
|
$_("..", null, "Discard the current context and go to parent");
|
||||||
|
Reference in New Issue
Block a user