Fossil SCM
added help --everything option that borrows functionality refactored from test-all-help
Commit
c39e23cda6ef5c9e035d1ce0e3784c0161eb25bc5ca79fb36db2133a1c388794
Parent
cf36fbb98f33361…
1 file changed
+47
-34
+47
-34
| --- src/dispatch.c | ||
| +++ src/dispatch.c | ||
| @@ -532,45 +532,14 @@ | ||
| 532 | 532 | blob_append(pText, zHelp, i); |
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | /* |
| 537 | -** COMMAND: test-all-help | |
| 538 | -** | |
| 539 | -** Usage: %fossil test-all-help ?OPTIONS? | |
| 540 | -** | |
| 541 | -** Show help text for commands and pages. Useful for proof-reading. | |
| 542 | -** Defaults to just the CLI commands. Specify --www to see only the | |
| 543 | -** web pages, or --everything to see both commands and pages. | |
| 544 | -** | |
| 545 | -** Options: | |
| 546 | -** -e|--everything Show all commands and pages. | |
| 547 | -** -t|--test Include test- commands | |
| 548 | -** -w|--www Show WWW pages. | |
| 549 | -** -s|--settings Show settings. | |
| 550 | -** -h|--html Transform output to HTML. | |
| 551 | -** -r|--raw No output formatting. | |
| 537 | +** Display help for all commands based on provided flags. | |
| 552 | 538 | */ |
| 553 | -void test_all_help_cmd(void){ | |
| 539 | +static void display_all_help(int mask, int useHtml, int rawOut){ | |
| 554 | 540 | int i; |
| 555 | - int mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER; | |
| 556 | - int useHtml = find_option("html","h",0)!=0; | |
| 557 | - int rawOut = find_option("raw","r",0)!=0; | |
| 558 | - | |
| 559 | - if( find_option("www","w",0) ){ | |
| 560 | - mask = CMDFLAG_WEBPAGE; | |
| 561 | - } | |
| 562 | - if( find_option("everything","e",0) ){ | |
| 563 | - mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE | | |
| 564 | - CMDFLAG_SETTING | CMDFLAG_TEST; | |
| 565 | - } | |
| 566 | - if( find_option("settings","s",0) ){ | |
| 567 | - mask = CMDFLAG_SETTING; | |
| 568 | - } | |
| 569 | - if( find_option("test","t",0) ){ | |
| 570 | - mask |= CMDFLAG_TEST; | |
| 571 | - } | |
| 572 | 541 | if( useHtml ) fossil_print("<!--\n"); |
| 573 | 542 | fossil_print("Help text for:\n"); |
| 574 | 543 | if( mask & CMDFLAG_1ST_TIER ) fossil_print(" * Commands\n"); |
| 575 | 544 | if( mask & CMDFLAG_2ND_TIER ) fossil_print(" * Auxiliary commands\n"); |
| 576 | 545 | if( mask & CMDFLAG_TEST ) fossil_print(" * Test commands\n"); |
| @@ -608,10 +577,48 @@ | ||
| 608 | 577 | }else{ |
| 609 | 578 | fossil_print("---\n"); |
| 610 | 579 | } |
| 611 | 580 | version_cmd(); |
| 612 | 581 | } |
| 582 | + | |
| 583 | +/* | |
| 584 | +** COMMAND: test-all-help | |
| 585 | +** | |
| 586 | +** Usage: %fossil test-all-help ?OPTIONS? | |
| 587 | +** | |
| 588 | +** Show help text for commands and pages. Useful for proof-reading. | |
| 589 | +** Defaults to just the CLI commands. Specify --www to see only the | |
| 590 | +** web pages, or --everything to see both commands and pages. | |
| 591 | +** | |
| 592 | +** Options: | |
| 593 | +** -e|--everything Show all commands and pages. | |
| 594 | +** -t|--test Include test- commands | |
| 595 | +** -w|--www Show WWW pages. | |
| 596 | +** -s|--settings Show settings. | |
| 597 | +** -h|--html Transform output to HTML. | |
| 598 | +** -r|--raw No output formatting. | |
| 599 | +*/ | |
| 600 | +void test_all_help_cmd(void){ | |
| 601 | + int mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER; | |
| 602 | + int useHtml = find_option("html","h",0)!=0; | |
| 603 | + int rawOut = find_option("raw","r",0)!=0; | |
| 604 | + | |
| 605 | + if( find_option("www","w",0) ){ | |
| 606 | + mask = CMDFLAG_WEBPAGE; | |
| 607 | + } | |
| 608 | + if( find_option("everything","e",0) ){ | |
| 609 | + mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE | | |
| 610 | + CMDFLAG_SETTING | CMDFLAG_TEST; | |
| 611 | + } | |
| 612 | + if( find_option("settings","s",0) ){ | |
| 613 | + mask = CMDFLAG_SETTING; | |
| 614 | + } | |
| 615 | + if( find_option("test","t",0) ){ | |
| 616 | + mask |= CMDFLAG_TEST; | |
| 617 | + } | |
| 618 | + display_all_help(mask, useHtml, rawOut); | |
| 619 | +} | |
| 613 | 620 | |
| 614 | 621 | /* |
| 615 | 622 | ** Count the number of entries in the aCommand[] table that match |
| 616 | 623 | ** the given flag. |
| 617 | 624 | */ |
| @@ -1028,10 +1035,11 @@ | ||
| 1028 | 1035 | ** -x|--aux List only auxiliary commands |
| 1029 | 1036 | ** -w|--www List all web pages |
| 1030 | 1037 | ** -f|--full List full set of commands (including auxiliary |
| 1031 | 1038 | ** and unsupported "test" commands), options, |
| 1032 | 1039 | ** settings, and web pages |
| 1040 | +** -e|--everything List all help on all topics | |
| 1033 | 1041 | ** |
| 1034 | 1042 | ** These options can be used when TOPIC is present: |
| 1035 | 1043 | ** |
| 1036 | 1044 | ** -h|--html Format output as HTML rather than plain text |
| 1037 | 1045 | ** -c|--commands Restrict TOPIC search to commands |
| @@ -1058,11 +1066,11 @@ | ||
| 1058 | 1066 | } |
| 1059 | 1067 | if( find_option("options","o",0) ){ |
| 1060 | 1068 | fossil_print("%s", zOptions); |
| 1061 | 1069 | return; |
| 1062 | 1070 | } |
| 1063 | - if( find_option("all","a",0) ){ | |
| 1071 | + else if( find_option("all","a",0) ){ | |
| 1064 | 1072 | command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER); |
| 1065 | 1073 | return; |
| 1066 | 1074 | } |
| 1067 | 1075 | else if( find_option("www","w",0) ){ |
| 1068 | 1076 | command_list(0, CMDFLAG_WEBPAGE); |
| @@ -1093,10 +1101,15 @@ | ||
| 1093 | 1101 | fossil_print("\nfossil test commands (unsupported):\n\n"); |
| 1094 | 1102 | command_list(0, CMDFLAG_TEST); |
| 1095 | 1103 | fossil_print("\n"); |
| 1096 | 1104 | version_cmd(); |
| 1097 | 1105 | return; |
| 1106 | + } | |
| 1107 | + else if( find_option("everything","e",0) ){ | |
| 1108 | + display_all_help(CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE | | |
| 1109 | + CMDFLAG_SETTING | CMDFLAG_TEST, 0, 0); | |
| 1110 | + return; | |
| 1098 | 1111 | } |
| 1099 | 1112 | useHtml = find_option("html","h",0)!=0; |
| 1100 | 1113 | isPage = ('/' == *g.argv[2]) ? 1 : 0; |
| 1101 | 1114 | if(isPage){ |
| 1102 | 1115 | zCmdOrPage = "page"; |
| 1103 | 1116 |
| --- src/dispatch.c | |
| +++ src/dispatch.c | |
| @@ -532,45 +532,14 @@ | |
| 532 | blob_append(pText, zHelp, i); |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | /* |
| 537 | ** COMMAND: test-all-help |
| 538 | ** |
| 539 | ** Usage: %fossil test-all-help ?OPTIONS? |
| 540 | ** |
| 541 | ** Show help text for commands and pages. Useful for proof-reading. |
| 542 | ** Defaults to just the CLI commands. Specify --www to see only the |
| 543 | ** web pages, or --everything to see both commands and pages. |
| 544 | ** |
| 545 | ** Options: |
| 546 | ** -e|--everything Show all commands and pages. |
| 547 | ** -t|--test Include test- commands |
| 548 | ** -w|--www Show WWW pages. |
| 549 | ** -s|--settings Show settings. |
| 550 | ** -h|--html Transform output to HTML. |
| 551 | ** -r|--raw No output formatting. |
| 552 | */ |
| 553 | void test_all_help_cmd(void){ |
| 554 | int i; |
| 555 | int mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER; |
| 556 | int useHtml = find_option("html","h",0)!=0; |
| 557 | int rawOut = find_option("raw","r",0)!=0; |
| 558 | |
| 559 | if( find_option("www","w",0) ){ |
| 560 | mask = CMDFLAG_WEBPAGE; |
| 561 | } |
| 562 | if( find_option("everything","e",0) ){ |
| 563 | mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE | |
| 564 | CMDFLAG_SETTING | CMDFLAG_TEST; |
| 565 | } |
| 566 | if( find_option("settings","s",0) ){ |
| 567 | mask = CMDFLAG_SETTING; |
| 568 | } |
| 569 | if( find_option("test","t",0) ){ |
| 570 | mask |= CMDFLAG_TEST; |
| 571 | } |
| 572 | if( useHtml ) fossil_print("<!--\n"); |
| 573 | fossil_print("Help text for:\n"); |
| 574 | if( mask & CMDFLAG_1ST_TIER ) fossil_print(" * Commands\n"); |
| 575 | if( mask & CMDFLAG_2ND_TIER ) fossil_print(" * Auxiliary commands\n"); |
| 576 | if( mask & CMDFLAG_TEST ) fossil_print(" * Test commands\n"); |
| @@ -608,10 +577,48 @@ | |
| 608 | }else{ |
| 609 | fossil_print("---\n"); |
| 610 | } |
| 611 | version_cmd(); |
| 612 | } |
| 613 | |
| 614 | /* |
| 615 | ** Count the number of entries in the aCommand[] table that match |
| 616 | ** the given flag. |
| 617 | */ |
| @@ -1028,10 +1035,11 @@ | |
| 1028 | ** -x|--aux List only auxiliary commands |
| 1029 | ** -w|--www List all web pages |
| 1030 | ** -f|--full List full set of commands (including auxiliary |
| 1031 | ** and unsupported "test" commands), options, |
| 1032 | ** settings, and web pages |
| 1033 | ** |
| 1034 | ** These options can be used when TOPIC is present: |
| 1035 | ** |
| 1036 | ** -h|--html Format output as HTML rather than plain text |
| 1037 | ** -c|--commands Restrict TOPIC search to commands |
| @@ -1058,11 +1066,11 @@ | |
| 1058 | } |
| 1059 | if( find_option("options","o",0) ){ |
| 1060 | fossil_print("%s", zOptions); |
| 1061 | return; |
| 1062 | } |
| 1063 | if( find_option("all","a",0) ){ |
| 1064 | command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER); |
| 1065 | return; |
| 1066 | } |
| 1067 | else if( find_option("www","w",0) ){ |
| 1068 | command_list(0, CMDFLAG_WEBPAGE); |
| @@ -1093,10 +1101,15 @@ | |
| 1093 | fossil_print("\nfossil test commands (unsupported):\n\n"); |
| 1094 | command_list(0, CMDFLAG_TEST); |
| 1095 | fossil_print("\n"); |
| 1096 | version_cmd(); |
| 1097 | return; |
| 1098 | } |
| 1099 | useHtml = find_option("html","h",0)!=0; |
| 1100 | isPage = ('/' == *g.argv[2]) ? 1 : 0; |
| 1101 | if(isPage){ |
| 1102 | zCmdOrPage = "page"; |
| 1103 |
| --- src/dispatch.c | |
| +++ src/dispatch.c | |
| @@ -532,45 +532,14 @@ | |
| 532 | blob_append(pText, zHelp, i); |
| 533 | } |
| 534 | } |
| 535 | |
| 536 | /* |
| 537 | ** Display help for all commands based on provided flags. |
| 538 | */ |
| 539 | static void display_all_help(int mask, int useHtml, int rawOut){ |
| 540 | int i; |
| 541 | if( useHtml ) fossil_print("<!--\n"); |
| 542 | fossil_print("Help text for:\n"); |
| 543 | if( mask & CMDFLAG_1ST_TIER ) fossil_print(" * Commands\n"); |
| 544 | if( mask & CMDFLAG_2ND_TIER ) fossil_print(" * Auxiliary commands\n"); |
| 545 | if( mask & CMDFLAG_TEST ) fossil_print(" * Test commands\n"); |
| @@ -608,10 +577,48 @@ | |
| 577 | }else{ |
| 578 | fossil_print("---\n"); |
| 579 | } |
| 580 | version_cmd(); |
| 581 | } |
| 582 | |
| 583 | /* |
| 584 | ** COMMAND: test-all-help |
| 585 | ** |
| 586 | ** Usage: %fossil test-all-help ?OPTIONS? |
| 587 | ** |
| 588 | ** Show help text for commands and pages. Useful for proof-reading. |
| 589 | ** Defaults to just the CLI commands. Specify --www to see only the |
| 590 | ** web pages, or --everything to see both commands and pages. |
| 591 | ** |
| 592 | ** Options: |
| 593 | ** -e|--everything Show all commands and pages. |
| 594 | ** -t|--test Include test- commands |
| 595 | ** -w|--www Show WWW pages. |
| 596 | ** -s|--settings Show settings. |
| 597 | ** -h|--html Transform output to HTML. |
| 598 | ** -r|--raw No output formatting. |
| 599 | */ |
| 600 | void test_all_help_cmd(void){ |
| 601 | int mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER; |
| 602 | int useHtml = find_option("html","h",0)!=0; |
| 603 | int rawOut = find_option("raw","r",0)!=0; |
| 604 | |
| 605 | if( find_option("www","w",0) ){ |
| 606 | mask = CMDFLAG_WEBPAGE; |
| 607 | } |
| 608 | if( find_option("everything","e",0) ){ |
| 609 | mask = CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE | |
| 610 | CMDFLAG_SETTING | CMDFLAG_TEST; |
| 611 | } |
| 612 | if( find_option("settings","s",0) ){ |
| 613 | mask = CMDFLAG_SETTING; |
| 614 | } |
| 615 | if( find_option("test","t",0) ){ |
| 616 | mask |= CMDFLAG_TEST; |
| 617 | } |
| 618 | display_all_help(mask, useHtml, rawOut); |
| 619 | } |
| 620 | |
| 621 | /* |
| 622 | ** Count the number of entries in the aCommand[] table that match |
| 623 | ** the given flag. |
| 624 | */ |
| @@ -1028,10 +1035,11 @@ | |
| 1035 | ** -x|--aux List only auxiliary commands |
| 1036 | ** -w|--www List all web pages |
| 1037 | ** -f|--full List full set of commands (including auxiliary |
| 1038 | ** and unsupported "test" commands), options, |
| 1039 | ** settings, and web pages |
| 1040 | ** -e|--everything List all help on all topics |
| 1041 | ** |
| 1042 | ** These options can be used when TOPIC is present: |
| 1043 | ** |
| 1044 | ** -h|--html Format output as HTML rather than plain text |
| 1045 | ** -c|--commands Restrict TOPIC search to commands |
| @@ -1058,11 +1066,11 @@ | |
| 1066 | } |
| 1067 | if( find_option("options","o",0) ){ |
| 1068 | fossil_print("%s", zOptions); |
| 1069 | return; |
| 1070 | } |
| 1071 | else if( find_option("all","a",0) ){ |
| 1072 | command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER); |
| 1073 | return; |
| 1074 | } |
| 1075 | else if( find_option("www","w",0) ){ |
| 1076 | command_list(0, CMDFLAG_WEBPAGE); |
| @@ -1093,10 +1101,15 @@ | |
| 1101 | fossil_print("\nfossil test commands (unsupported):\n\n"); |
| 1102 | command_list(0, CMDFLAG_TEST); |
| 1103 | fossil_print("\n"); |
| 1104 | version_cmd(); |
| 1105 | return; |
| 1106 | } |
| 1107 | else if( find_option("everything","e",0) ){ |
| 1108 | display_all_help(CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER | CMDFLAG_WEBPAGE | |
| 1109 | CMDFLAG_SETTING | CMDFLAG_TEST, 0, 0); |
| 1110 | return; |
| 1111 | } |
| 1112 | useHtml = find_option("html","h",0)!=0; |
| 1113 | isPage = ('/' == *g.argv[2]) ? 1 : 0; |
| 1114 | if(isPage){ |
| 1115 | zCmdOrPage = "page"; |
| 1116 |