|
|
|
@ -1673,6 +1673,71 @@ static int help_workhorse(int fd, char *match[])
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#ifdef AST_DEVMODE
|
|
|
|
|
static char *handle_agi_dump_commanddocs(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
|
|
|
|
{
|
|
|
|
|
FILE *f;
|
|
|
|
|
char *command_name = NULL;
|
|
|
|
|
const char *fn = "/tmp/ast_agi_commands.tex";
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
|
case CLI_INIT:
|
|
|
|
|
e->command = "agi dump commanddocs";
|
|
|
|
|
e->usage =
|
|
|
|
|
"Usage: agi dump commanddocs [command]\n"
|
|
|
|
|
" Dump manager action documentation to /tmp/ast_agi_commands.tex.\n";
|
|
|
|
|
return NULL;
|
|
|
|
|
case CLI_GENERATE:
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (a->argc == e->args + 1)
|
|
|
|
|
command_name = a->argv[e->args];
|
|
|
|
|
else if (a->argc != e->args)
|
|
|
|
|
return CLI_SHOWUSAGE;
|
|
|
|
|
|
|
|
|
|
if (!(f = fopen(fn, "w+"))) {
|
|
|
|
|
ast_cli(a->fd, "Unable to open %s for writing!\n", fn);
|
|
|
|
|
return CLI_FAILURE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fprintf(f, "%% This file is automatically generated by the \"manager dump actiondocs\" CLI command. Any manual edits will be lost.\n");
|
|
|
|
|
|
|
|
|
|
/* XXX Not thread safe :( */
|
|
|
|
|
for (i = 0; i < ARRAY_LEN(commands); i++) {
|
|
|
|
|
struct agi_command *command;
|
|
|
|
|
char fullcmd[80];
|
|
|
|
|
|
|
|
|
|
command = &commands[i];
|
|
|
|
|
ast_join(fullcmd, sizeof(fullcmd), command->cmda);
|
|
|
|
|
|
|
|
|
|
if (command_name && strcasecmp(fullcmd, command_name))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
fprintf(f, "\\section{%s}\n"
|
|
|
|
|
"\\subsection{Summary}\n"
|
|
|
|
|
"\\begin{verbatim}\n"
|
|
|
|
|
"%s\n"
|
|
|
|
|
"\\end{verbatim}\n"
|
|
|
|
|
"\\subsection{Usage}\n"
|
|
|
|
|
"\\begin{verbatim}\n"
|
|
|
|
|
"%s\n"
|
|
|
|
|
"\\end{verbatim}\n\n\n",
|
|
|
|
|
fullcmd, command->summary, command->usage);
|
|
|
|
|
|
|
|
|
|
if (command_name)
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fclose(f);
|
|
|
|
|
|
|
|
|
|
ast_cli(a->fd, "Documentation has been dumped to %s\n", fn);
|
|
|
|
|
|
|
|
|
|
return CLI_SUCCESS;
|
|
|
|
|
}
|
|
|
|
|
#endif /* AST_DEVMODE */
|
|
|
|
|
|
|
|
|
|
int ast_agi_register(agi_command *agi)
|
|
|
|
|
{
|
|
|
|
|
int x;
|
|
|
|
@ -2164,6 +2229,10 @@ static struct ast_cli_entry cli_agi[] = {
|
|
|
|
|
{ { "agi", "dumphtml", NULL },
|
|
|
|
|
handle_agidumphtml, "Dumps a list of agi commands in html format",
|
|
|
|
|
dumpagihtml_help },
|
|
|
|
|
|
|
|
|
|
#ifdef AST_DEVMODE
|
|
|
|
|
NEW_CLI(handle_agi_dump_commanddocs, "Dump agi command documentation in LaTeX format"),
|
|
|
|
|
#endif
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static int unload_module(void)
|
|
|
|
|