diff --git a/src/command/command.c b/src/command/command.c index b2d3be9b..593adbd9 100644 --- a/src/command/command.c +++ b/src/command/command.c @@ -3510,22 +3510,80 @@ command_docgen(void) while (curr) { Command *pcmd = curr->data; - fprintf(toc_fragment, "%s,\n", &pcmd->cmd[1], pcmd->cmd); - fprintf(main_fragment, "\n", &pcmd->cmd[1]); - fprintf(main_fragment, "

%s

\n", pcmd->cmd); - fputs("

Usage:

\n", main_fragment); - fprintf(main_fragment, "

%s

\n", pcmd->help.usage); + // old style + if (pcmd->help.usage) { +// fprintf(toc_fragment, "%s,\n", &pcmd->cmd[1], pcmd->cmd); +// fprintf(main_fragment, "\n", &pcmd->cmd[1]); +// fprintf(main_fragment, "

%s

\n", pcmd->cmd); +// fputs("

Usage:

\n", main_fragment); +// fprintf(main_fragment, "

%s

\n", pcmd->help.usage); +// +// fputs("

Details:

\n", main_fragment); +// fputs("

", main_fragment);
+//            int i = 2;
+//            while (pcmd->help.long_help[i]) {
+//                fprintf(main_fragment, "%s\n", pcmd->help.long_help[i++]);
+//            }
+//            fputs("

\n
back to top


\n", main_fragment); +// fputs("\n", main_fragment); - fputs("

Details:

\n", main_fragment); - fputs("

", main_fragment);
-        int i = 2;
-        while (pcmd->help.long_help[i]) {
-            fprintf(main_fragment, "%s\n", pcmd->help.long_help[i++]);
+        // new style
+        } else {
+            fprintf(toc_fragment, "%s,\n", &pcmd->cmd[1], pcmd->cmd);
+            fprintf(main_fragment, "\n", &pcmd->cmd[1]);
+            fprintf(main_fragment, "

%s

\n", pcmd->cmd); + + fputs("

Synopsis

\n", main_fragment); + fputs("

", main_fragment);
+            int i = 0;
+            while (pcmd->help.synopsis[i]) {
+                char *str1 = str_replace(pcmd->help.synopsis[i], "<", "<");
+                char *str2 = str_replace(str1, ">", ">");
+                fprintf(main_fragment, "%s\n", str2);
+                i++;
+            }
+            fputs("

\n", main_fragment); + + fputs("

Description

\n", main_fragment); + fputs("

", main_fragment); + fprintf(main_fragment, "%s\n", pcmd->help.desc); + fputs("

\n", main_fragment); + + if (pcmd->help.args[0][0] != NULL) { + fputs("

Arguments

\n", main_fragment); + fputs("", main_fragment); + for (i = 0; pcmd->help.args[i][0] != NULL; i++) { + fputs("", main_fragment); + fputs("", main_fragment); + fputs("", main_fragment); + fputs("", main_fragment); + } + fputs("
", main_fragment); + fputs("", main_fragment); + char *str1 = str_replace(pcmd->help.args[i][0], "<", "<"); + char *str2 = str_replace(str1, ">", ">"); + fprintf(main_fragment, "%s", str2); + fputs("", main_fragment); + fputs("", main_fragment); + fprintf(main_fragment, "%s", pcmd->help.args[i][1]); + fputs("
\n", main_fragment); + } + + if (pcmd->help.examples[0] != NULL) { + fputs("

Examples

\n", main_fragment); + fputs("

", main_fragment);
+                int i = 0;
+                while (pcmd->help.examples[i]) {
+                    fprintf(main_fragment, "%s\n", pcmd->help.examples[i]);
+                    i++;
+                }
+                fputs("

\n", main_fragment); + } + + fputs("
back to top


\n", main_fragment); + fputs("\n", main_fragment); } - fputs("

\n
back to top


\n", main_fragment); - fputs("\n", main_fragment); - curr = g_list_next(curr); }