add source command
authorkrakjoe <joe.watkins@live.co.uk>
Mon, 25 Nov 2013 16:39:14 +0000 (16:39 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Mon, 25 Nov 2013 16:39:14 +0000 (16:39 +0000)
phpdbg_help.c
phpdbg_help.h
phpdbg_prompt.c
phpdbg_prompt.h

index f233d9005e02fe710947f445c64464666364188c..fe621fb818890a287a225196aaca37a79d943103 100644 (file)
@@ -501,6 +501,19 @@ PHPDBG_HELP(register) /* {{{ */
     return SUCCESS;
 } /* }}} */
 
+PHPDBG_HELP(source) /* {{{ */
+{
+       phpdbg_help_header();
+       phpdbg_writeln("Sourcing a phpdbginit during your debugging session might save some time");
+       phpdbg_writeln(EMPTY);
+    phpdbg_notice("Examples");
+       phpdbg_writeln("\t%ssource /my/phpdbginit", PROMPT);
+    phpdbg_writeln("\t%s. /my/phpdbginit", PROMPT);
+    phpdbg_writeln("\tWill execute the init file at /my/phpdbginit");
+       phpdbg_help_footer();
+       return SUCCESS;
+} /* }}} */
+
 PHPDBG_HELP(shell) /* {{{ */
 {
        phpdbg_help_header();
index d1e37ace5eaab4ec5ce25b15e1aff50e7425b9c4..f9306e5c61f2b39567b6d86537cd0a4966d45bfb 100644 (file)
@@ -48,6 +48,7 @@ PHPDBG_HELP(frame);
 PHPDBG_HELP(quiet);
 PHPDBG_HELP(list);
 PHPDBG_HELP(set);
+PHPDBG_HELP(source);
 PHPDBG_HELP(register);
 PHPDBG_HELP(options);
 PHPDBG_HELP(shell);
@@ -75,6 +76,7 @@ static const phpdbg_command_t phpdbg_help_commands[] = {
     PHPDBG_COMMAND_D_EX(quiet,    "be quiet during execution",                                                       'Q', help_quiet,   NULL, 0),
        PHPDBG_COMMAND_D_EX(list,     "list code gives you quick access to code",                                                        'l', help_list,    NULL, 0),
        PHPDBG_COMMAND_D_EX(set,      "configure how phpdbg looks and behaves",                                                                                  'S', help_set,     NULL, 0),
+       PHPDBG_COMMAND_D_EX(source,   "load a phpdbginit file at the console",                                                                                   '.', help_source,      NULL, 0),
        PHPDBG_COMMAND_D_EX(register, "register a function for use as a command",                                                                                'R', help_register,NULL, 0),
        PHPDBG_COMMAND_D_EX(options,  "show information about command line options",                                             'o', help_options, NULL, 0),
        PHPDBG_COMMAND_D_EX(shell,    "execute system commands with direct shell access",                                                                '-', help_shell,   NULL, 0),
index b1e5aecf88a88e2827d30761467742778908d36a..7328d4f075c7735835d60111284ab47c26a2b003 100644 (file)
@@ -59,6 +59,7 @@ const phpdbg_command_t phpdbg_prompt_commands[] = {
        PHPDBG_COMMAND_D(aliases, "show alias list",                          'a', NULL, 0),
        PHPDBG_COMMAND_D(set,     "set phpdbg configuration",                 'S', phpdbg_set_commands,   1),
        PHPDBG_COMMAND_D(register,"register a function",                      'R', NULL, 1),
+       PHPDBG_COMMAND_D(source,  "execute a phpdbginit",                     '.', NULL, 1),
        PHPDBG_COMMAND_D(shell,   "shell a command",                          '-', NULL, 1),
        PHPDBG_COMMAND_D(quit,    "exit phpdbg",                              'q', NULL, 0),
        PHPDBG_END_COMMAND
@@ -822,6 +823,18 @@ PHPDBG_COMMAND(shell) /* {{{ */
        return SUCCESS;
 } /* }}} */
 
+PHPDBG_COMMAND(source) /* {{{ */
+{
+       switch (param->type) {
+               case STR_PARAM: {
+                       phpdbg_init(param->str, param->len, 0 TSRMLS_CC);
+               } break;
+
+               phpdbg_default_switch_case();
+       }
+       return SUCCESS;
+} /* }}} */
+
 PHPDBG_COMMAND(register) /* {{{ */
 {
        switch (param->type) {
index d227422c5536f910a2f8452987a09e01d2c02de5..8ed2d83c409be770558954ecd01ae2c9b0bc1fd2 100644 (file)
@@ -49,6 +49,7 @@ PHPDBG_COMMAND(quiet);
 PHPDBG_COMMAND(aliases);
 PHPDBG_COMMAND(shell);
 PHPDBG_COMMAND(set);
+PHPDBG_COMMAND(source);
 PHPDBG_COMMAND(register);
 PHPDBG_COMMAND(quit); /* }}} */