add set colors command to assist remote console

This commit is contained in:
krakjoe 2013-11-28 17:02:38 +00:00
parent b2af85a445
commit 26e1d57e8c
3 changed files with 35 additions and 1 deletions

View file

@ -57,7 +57,9 @@ PHPDBG_SET(break) /* {{{ */
}
break;
phpdbg_default_switch_case();
default:
phpdbg_error(
"set break used incorrectly: set break <on|off>");
}
return SUCCESS;
@ -71,6 +73,7 @@ PHPDBG_SET(color) /* {{{ */
input->argv[2]->string, input->argv[2]->length TSRMLS_CC);
int element = PHPDBG_COLOR_INVALID;
/* @TODO(anyone) make this consistent with other set commands */
if (color) {
if (phpdbg_argv_is(1, "prompt")) {
phpdbg_notice(
@ -105,6 +108,34 @@ usage:
}
return SUCCESS;
} /* }}} */
PHPDBG_SET(colors) /* {{{ */
{
switch (param->type) {
case EMPTY_PARAM: {
phpdbg_writeln(
"%s", PHPDBG_G(flags) & PHPDBG_IS_COLOURED ? "on" : "off");
goto done;
}
case STR_PARAM: {
if (strncasecmp(param->str, PHPDBG_STRL("on")) == 0) {
PHPDBG_G(flags) |= PHPDBG_IS_COLOURED;
goto done;
} else if (strncasecmp(param->str, PHPDBG_STRL("off")) == 0) {
PHPDBG_G(flags) &= ~PHPDBG_IS_COLOURED;
goto done;
}
}
}
usage:
phpdbg_error(
"set colors used incorrectly: set colors <on|off>");
done:
return SUCCESS;
} /* }}} */
#endif
PHPDBG_SET(oplog) /* {{{ */