summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkrakjoe <joe.watkins@live.co.uk>2013-11-24 20:16:46 +0000
committerkrakjoe <joe.watkins@live.co.uk>2013-11-24 20:16:46 +0000
commit5596b2e7163dfa2f73b0a8a3c7af0963a7b917c6 (patch)
treeda5d9267ad82e980e5c3959a0f2917f932eb46a0
parentde61c0c28abe0f95bd9aef31d2154c5022ea5917 (diff)
downloadphp-git-5596b2e7163dfa2f73b0a8a3c7af0963a7b917c6.tar.gz
example colour output
-rw-r--r--phpdbg_help.c17
-rw-r--r--phpdbg_utils.c5
-rw-r--r--phpdbg_utils.h3
3 files changed, 24 insertions, 1 deletions
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 09f16252d3..263ce6c1c9 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -450,6 +450,23 @@ PHPDBG_HELP(set) /* {{{ */
++set_command;
}
}
+ phpdbg_notice("Colors");
+ {
+ const phpdbg_color_t *color = phpdbg_get_colors(TSRMLS_C);
+
+ if (PHPDBG_G(flags) & PHPDBG_IS_COLOURED) {
+ phpdbg_writeln("\t%-15s\t\tExample", "Name");
+ } else phpdbg_writeln("\tName");
+
+ while (color && color->name) {
+ if (PHPDBG_G(flags) & PHPDBG_IS_COLOURED) {
+ phpdbg_writeln(
+ "\t%-15s\t\t\033[%smphpdbg rocks :)\033[0m", color->name, color->code);
+ } else phpdbg_writeln("\t%s", color->name);
+
+ ++color;
+ }
+ }
phpdbg_help_footer();
return SUCCESS;
} /* }}} */
diff --git a/phpdbg_utils.c b/phpdbg_utils.c
index 17bc04ca42..5240d57cc0 100644
--- a/phpdbg_utils.c
+++ b/phpdbg_utils.c
@@ -259,6 +259,11 @@ PHPDBG_API void phpdbg_set_color_ex(int element, const char *name, size_t name_l
} else PHPDBG_G(colors)[element] = colors;
} /* }}} */
+PHPDBG_API const phpdbg_color_t* phpdbg_get_colors(TSRMLS_D) /* {{{ */
+{
+ return colors;
+} /* }}} */
+
PHPDBG_API void phpdbg_set_prompt(const char *prompt TSRMLS_DC) /* {{{ */
{
/* free formatted prompt */
diff --git a/phpdbg_utils.h b/phpdbg_utils.h
index 18b6a47141..b85a76ae3a 100644
--- a/phpdbg_utils.h
+++ b/phpdbg_utils.h
@@ -96,7 +96,8 @@ typedef struct _phpdbg_color_t {
PHPDBG_API const phpdbg_color_t* phpdbg_get_color(const char *name, size_t name_length TSRMLS_DC);
PHPDBG_API void phpdbg_set_color(int element, const phpdbg_color_t *color TSRMLS_DC);
-PHPDBG_API void phpdbg_set_color_ex(int element, const char *name, size_t name_length TSRMLS_DC); /* }}} */
+PHPDBG_API void phpdbg_set_color_ex(int element, const char *name, size_t name_length TSRMLS_DC);
+PHPDBG_API const phpdbg_color_t* phpdbg_get_colors(TSRMLS_D); /* }}} */
/* {{{ Prompt Management */
PHPDBG_API void phpdbg_set_prompt(const char* TSRMLS_DC);