Fossil SCM

merged in [help-www] branch: adds help support for /www/pages.

stephan 2013-02-22 17:34 trunk merge
Commit b38bb4f9bd27d0347b62ecfac63c4b8f57b5c93b
4 files changed +71 -20 +71 -20 +22 -17 +1 -1
+71 -20
--- src/main.c
+++ src/main.c
@@ -730,14 +730,17 @@
730730
**
731731
** List all web pages
732732
*/
733733
void cmd_test_webpage_list(void){
734734
int i, nCmd;
735
- const char *aCmd[count(aWebpage)];
736
- for(i=nCmd=0; i<count(aWebpage); i++){
737
- aCmd[nCmd++] = aWebpage[i].zName;
735
+ const char *aCmd[count(aCommand)];
736
+ for(i=nCmd=0; i<count(aCommand); i++){
737
+ if(0x08 & aCommand[i].cmdFlags){
738
+ aCmd[nCmd++] = aWebpage[i].zName;
739
+ }
738740
}
741
+ assert(nCmd && "page list is empty?");
739742
multi_column_list(aCmd, nCmd);
740743
}
741744
742745
/*
743746
** COMMAND: version
@@ -763,14 +766,17 @@
763766
**
764767
** %fossil help Show common commands
765768
** %fossil help --all Show both common and auxiliary commands
766769
** %fossil help --test Show test commands only
767770
** %fossil help --aux Show auxiliary commands only
771
+** %fossil help --www Show list of WWW pages
768772
*/
769773
void help_cmd(void){
770
- int rc, idx;
774
+ int rc, idx, isPage = 0;
771775
const char *z;
776
+ char const * zCmdOrPage;
777
+ char const * zCmdOrPagePlural;
772778
if( g.argc<3 ){
773779
z = g.argv[0];
774780
fossil_print(
775781
"Usage: %s help COMMAND\n"
776782
"Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
@@ -781,33 +787,46 @@
781787
}
782788
if( find_option("all",0,0) ){
783789
command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
784790
return;
785791
}
786
- if( find_option("aux",0,0) ){
792
+ else if( find_option("www",0,0) ){
793
+ command_list(0, CMDFLAG_WEBPAGE);
794
+ return;
795
+ }
796
+ else if( find_option("aux",0,0) ){
787797
command_list(0, CMDFLAG_2ND_TIER);
788798
return;
789799
}
790
- if( find_option("test",0,0) ){
800
+ else if( find_option("test",0,0) ){
791801
command_list(0, CMDFLAG_TEST);
792802
return;
803
+ }
804
+ isPage = ('/' == *g.argv[2]) ? 1 : 0;
805
+ if(isPage){
806
+ zCmdOrPage = "page";
807
+ zCmdOrPagePlural = "pages";
808
+ }else{
809
+ zCmdOrPage = "command";
810
+ zCmdOrPagePlural = "commands";
793811
}
794812
rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
795813
if( rc==1 ){
796
- fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
797
- command_list(0, 0xff);
814
+ fossil_print("unknown %s: %s\nAvailable %s:\n",
815
+ zCmdOrPage, g.argv[2], zCmdOrPagePlural);
816
+ command_list(0, isPage ? CMDFLAG_WEBPAGE : (0xff & ~CMDFLAG_WEBPAGE));
798817
fossil_exit(1);
799818
}else if( rc==2 ){
800
- fossil_print("ambiguous command prefix: %s\nMatching commands:\n",
801
- g.argv[2]);
819
+ fossil_print("ambiguous %s prefix: %s\nMatching %s:\n",
820
+ zCmdOrPage, g.argv[2], zCmdOrPagePlural);
802821
command_list(g.argv[2], 0xff);
803822
fossil_exit(1);
804823
}
805
- z = aCmdHelp[idx];
824
+ z = aCmdHelp[idx].zText;
806825
if( z==0 ){
807
- fossil_fatal("no help available for the %s command",
808
- aCommand[idx].zName);
826
+ fossil_fatal("no help available for the %s %s",
827
+ aCommand[idx].zName, zCmdOrPage);
809828
}
810829
while( *z ){
811830
if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
812831
fossil_print("%s", g.argv[0]);
813832
z += 7;
@@ -829,20 +848,20 @@
829848
if( zCmd==0 ) zCmd = P("name");
830849
style_header("Command-line Help");
831850
if( zCmd ){
832851
int rc, idx;
833852
char *z, *s, *d;
834
-
853
+ char const * zCmdOrPage = ('/'==*zCmd) ? "page" : "command";
835854
style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
836
- @ <h1>The "%s(zCmd)" command:</h1>
855
+ @ <h1>The "%s(zCmd)" %s(zCmdOrPage):</h1>
837856
rc = name_search(zCmd, aCommand, count(aCommand), &idx);
838857
if( rc==1 ){
839858
@ unknown command: %s(zCmd)
840859
}else if( rc==2 ){
841860
@ ambiguous command prefix: %s(zCmd)
842861
}else{
843
- z = (char*)aCmdHelp[idx];
862
+ z = (char*)aCmdHelp[idx].zText;
844863
if( z==0 ){
845864
@ no help available for the %s(aCommand[idx].zName) command
846865
}else{
847866
z=s=d=mprintf("%s",z);
848867
while( *s ){
@@ -864,21 +883,52 @@
864883
865884
@ <h1>Available commands:</h1>
866885
@ <table border="0"><tr>
867886
for(i=j=0; i<count(aCommand); i++){
868887
const char *z = aCommand[i].zName;
869
- if( strncmp(z,"test",4)==0 ) continue;
888
+ if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
870889
j++;
871890
}
872891
n = (j+6)/7;
873892
for(i=j=0; i<count(aCommand); i++){
874893
const char *z = aCommand[i].zName;
875
- if( strncmp(z,"test",4)==0 ) continue;
894
+ if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
895
+ if( j==0 ){
896
+ @ <td valign="top"><ul>
897
+ }
898
+ @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a></li>
899
+ j++;
900
+ if( j>=n ){
901
+ @ </ul></td>
902
+ j = 0;
903
+ }
904
+ }
905
+ if( j>0 ){
906
+ @ </ul></td>
907
+ }
908
+ @ </tr></table>
909
+
910
+ @ <h1>Available pages:</h1>
911
+ @ (Only pages with help text are linked.)
912
+ @ <table border="0"><tr>
913
+ for(i=j=0; i<count(aCommand); i++){
914
+ const char *z = aCommand[i].zName;
915
+ if( '/'!=*z ) continue;
916
+ j++;
917
+ }
918
+ n = (j+4)/5;
919
+ for(i=j=0; i<count(aCommand); i++){
920
+ const char *z = aCommand[i].zName;
921
+ if( '/'!=*z ) continue;
876922
if( j==0 ){
877923
@ <td valign="top"><ul>
878924
}
879
- @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a>
925
+ if( aCmdHelp[i].zText && *aCmdHelp[i].zText ){
926
+ @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z+1)</a></li>
927
+ }else{
928
+ @ <li>%s(z+1)</li>
929
+ }
880930
j++;
881931
if( j>=n ){
882932
@ </ul></td>
883933
j = 0;
884934
}
@@ -885,10 +935,11 @@
885935
}
886936
if( j>0 ){
887937
@ </ul></td>
888938
}
889939
@ </tr></table>
940
+
890941
}
891942
style_footer();
892943
}
893944
894945
/*
@@ -901,11 +952,11 @@
901952
style_header("Testpage: All Help Text");
902953
for(i=0; i<count(aCommand); i++){
903954
if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
904955
@ <h2>%s(aCommand[i].zName):</h2>
905956
@ <blockquote><pre>
906
- @ %h(aCmdHelp[i])
957
+ @ %h(aCmdHelp[i].zText)
907958
@ </pre></blockquote>
908959
}
909960
style_footer();
910961
}
911962
912963
--- src/main.c
+++ src/main.c
@@ -730,14 +730,17 @@
730 **
731 ** List all web pages
732 */
733 void cmd_test_webpage_list(void){
734 int i, nCmd;
735 const char *aCmd[count(aWebpage)];
736 for(i=nCmd=0; i<count(aWebpage); i++){
737 aCmd[nCmd++] = aWebpage[i].zName;
 
 
738 }
 
739 multi_column_list(aCmd, nCmd);
740 }
741
742 /*
743 ** COMMAND: version
@@ -763,14 +766,17 @@
763 **
764 ** %fossil help Show common commands
765 ** %fossil help --all Show both common and auxiliary commands
766 ** %fossil help --test Show test commands only
767 ** %fossil help --aux Show auxiliary commands only
 
768 */
769 void help_cmd(void){
770 int rc, idx;
771 const char *z;
 
 
772 if( g.argc<3 ){
773 z = g.argv[0];
774 fossil_print(
775 "Usage: %s help COMMAND\n"
776 "Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
@@ -781,33 +787,46 @@
781 }
782 if( find_option("all",0,0) ){
783 command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
784 return;
785 }
786 if( find_option("aux",0,0) ){
 
 
 
 
787 command_list(0, CMDFLAG_2ND_TIER);
788 return;
789 }
790 if( find_option("test",0,0) ){
791 command_list(0, CMDFLAG_TEST);
792 return;
 
 
 
 
 
 
 
 
793 }
794 rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
795 if( rc==1 ){
796 fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
797 command_list(0, 0xff);
 
798 fossil_exit(1);
799 }else if( rc==2 ){
800 fossil_print("ambiguous command prefix: %s\nMatching commands:\n",
801 g.argv[2]);
802 command_list(g.argv[2], 0xff);
803 fossil_exit(1);
804 }
805 z = aCmdHelp[idx];
806 if( z==0 ){
807 fossil_fatal("no help available for the %s command",
808 aCommand[idx].zName);
809 }
810 while( *z ){
811 if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
812 fossil_print("%s", g.argv[0]);
813 z += 7;
@@ -829,20 +848,20 @@
829 if( zCmd==0 ) zCmd = P("name");
830 style_header("Command-line Help");
831 if( zCmd ){
832 int rc, idx;
833 char *z, *s, *d;
834
835 style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
836 @ <h1>The "%s(zCmd)" command:</h1>
837 rc = name_search(zCmd, aCommand, count(aCommand), &idx);
838 if( rc==1 ){
839 @ unknown command: %s(zCmd)
840 }else if( rc==2 ){
841 @ ambiguous command prefix: %s(zCmd)
842 }else{
843 z = (char*)aCmdHelp[idx];
844 if( z==0 ){
845 @ no help available for the %s(aCommand[idx].zName) command
846 }else{
847 z=s=d=mprintf("%s",z);
848 while( *s ){
@@ -864,21 +883,52 @@
864
865 @ <h1>Available commands:</h1>
866 @ <table border="0"><tr>
867 for(i=j=0; i<count(aCommand); i++){
868 const char *z = aCommand[i].zName;
869 if( strncmp(z,"test",4)==0 ) continue;
870 j++;
871 }
872 n = (j+6)/7;
873 for(i=j=0; i<count(aCommand); i++){
874 const char *z = aCommand[i].zName;
875 if( strncmp(z,"test",4)==0 ) continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876 if( j==0 ){
877 @ <td valign="top"><ul>
878 }
879 @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a>
 
 
 
 
880 j++;
881 if( j>=n ){
882 @ </ul></td>
883 j = 0;
884 }
@@ -885,10 +935,11 @@
885 }
886 if( j>0 ){
887 @ </ul></td>
888 }
889 @ </tr></table>
 
890 }
891 style_footer();
892 }
893
894 /*
@@ -901,11 +952,11 @@
901 style_header("Testpage: All Help Text");
902 for(i=0; i<count(aCommand); i++){
903 if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
904 @ <h2>%s(aCommand[i].zName):</h2>
905 @ <blockquote><pre>
906 @ %h(aCmdHelp[i])
907 @ </pre></blockquote>
908 }
909 style_footer();
910 }
911
912
--- src/main.c
+++ src/main.c
@@ -730,14 +730,17 @@
730 **
731 ** List all web pages
732 */
733 void cmd_test_webpage_list(void){
734 int i, nCmd;
735 const char *aCmd[count(aCommand)];
736 for(i=nCmd=0; i<count(aCommand); i++){
737 if(0x08 & aCommand[i].cmdFlags){
738 aCmd[nCmd++] = aWebpage[i].zName;
739 }
740 }
741 assert(nCmd && "page list is empty?");
742 multi_column_list(aCmd, nCmd);
743 }
744
745 /*
746 ** COMMAND: version
@@ -763,14 +766,17 @@
766 **
767 ** %fossil help Show common commands
768 ** %fossil help --all Show both common and auxiliary commands
769 ** %fossil help --test Show test commands only
770 ** %fossil help --aux Show auxiliary commands only
771 ** %fossil help --www Show list of WWW pages
772 */
773 void help_cmd(void){
774 int rc, idx, isPage = 0;
775 const char *z;
776 char const * zCmdOrPage;
777 char const * zCmdOrPagePlural;
778 if( g.argc<3 ){
779 z = g.argv[0];
780 fossil_print(
781 "Usage: %s help COMMAND\n"
782 "Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
@@ -781,33 +787,46 @@
787 }
788 if( find_option("all",0,0) ){
789 command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
790 return;
791 }
792 else if( find_option("www",0,0) ){
793 command_list(0, CMDFLAG_WEBPAGE);
794 return;
795 }
796 else if( find_option("aux",0,0) ){
797 command_list(0, CMDFLAG_2ND_TIER);
798 return;
799 }
800 else if( find_option("test",0,0) ){
801 command_list(0, CMDFLAG_TEST);
802 return;
803 }
804 isPage = ('/' == *g.argv[2]) ? 1 : 0;
805 if(isPage){
806 zCmdOrPage = "page";
807 zCmdOrPagePlural = "pages";
808 }else{
809 zCmdOrPage = "command";
810 zCmdOrPagePlural = "commands";
811 }
812 rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
813 if( rc==1 ){
814 fossil_print("unknown %s: %s\nAvailable %s:\n",
815 zCmdOrPage, g.argv[2], zCmdOrPagePlural);
816 command_list(0, isPage ? CMDFLAG_WEBPAGE : (0xff & ~CMDFLAG_WEBPAGE));
817 fossil_exit(1);
818 }else if( rc==2 ){
819 fossil_print("ambiguous %s prefix: %s\nMatching %s:\n",
820 zCmdOrPage, g.argv[2], zCmdOrPagePlural);
821 command_list(g.argv[2], 0xff);
822 fossil_exit(1);
823 }
824 z = aCmdHelp[idx].zText;
825 if( z==0 ){
826 fossil_fatal("no help available for the %s %s",
827 aCommand[idx].zName, zCmdOrPage);
828 }
829 while( *z ){
830 if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
831 fossil_print("%s", g.argv[0]);
832 z += 7;
@@ -829,20 +848,20 @@
848 if( zCmd==0 ) zCmd = P("name");
849 style_header("Command-line Help");
850 if( zCmd ){
851 int rc, idx;
852 char *z, *s, *d;
853 char const * zCmdOrPage = ('/'==*zCmd) ? "page" : "command";
854 style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
855 @ <h1>The "%s(zCmd)" %s(zCmdOrPage):</h1>
856 rc = name_search(zCmd, aCommand, count(aCommand), &idx);
857 if( rc==1 ){
858 @ unknown command: %s(zCmd)
859 }else if( rc==2 ){
860 @ ambiguous command prefix: %s(zCmd)
861 }else{
862 z = (char*)aCmdHelp[idx].zText;
863 if( z==0 ){
864 @ no help available for the %s(aCommand[idx].zName) command
865 }else{
866 z=s=d=mprintf("%s",z);
867 while( *s ){
@@ -864,21 +883,52 @@
883
884 @ <h1>Available commands:</h1>
885 @ <table border="0"><tr>
886 for(i=j=0; i<count(aCommand); i++){
887 const char *z = aCommand[i].zName;
888 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
889 j++;
890 }
891 n = (j+6)/7;
892 for(i=j=0; i<count(aCommand); i++){
893 const char *z = aCommand[i].zName;
894 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
895 if( j==0 ){
896 @ <td valign="top"><ul>
897 }
898 @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a></li>
899 j++;
900 if( j>=n ){
901 @ </ul></td>
902 j = 0;
903 }
904 }
905 if( j>0 ){
906 @ </ul></td>
907 }
908 @ </tr></table>
909
910 @ <h1>Available pages:</h1>
911 @ (Only pages with help text are linked.)
912 @ <table border="0"><tr>
913 for(i=j=0; i<count(aCommand); i++){
914 const char *z = aCommand[i].zName;
915 if( '/'!=*z ) continue;
916 j++;
917 }
918 n = (j+4)/5;
919 for(i=j=0; i<count(aCommand); i++){
920 const char *z = aCommand[i].zName;
921 if( '/'!=*z ) continue;
922 if( j==0 ){
923 @ <td valign="top"><ul>
924 }
925 if( aCmdHelp[i].zText && *aCmdHelp[i].zText ){
926 @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z+1)</a></li>
927 }else{
928 @ <li>%s(z+1)</li>
929 }
930 j++;
931 if( j>=n ){
932 @ </ul></td>
933 j = 0;
934 }
@@ -885,10 +935,11 @@
935 }
936 if( j>0 ){
937 @ </ul></td>
938 }
939 @ </tr></table>
940
941 }
942 style_footer();
943 }
944
945 /*
@@ -901,11 +952,11 @@
952 style_header("Testpage: All Help Text");
953 for(i=0; i<count(aCommand); i++){
954 if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
955 @ <h2>%s(aCommand[i].zName):</h2>
956 @ <blockquote><pre>
957 @ %h(aCmdHelp[i].zText)
958 @ </pre></blockquote>
959 }
960 style_footer();
961 }
962
963
+71 -20
--- src/main.c
+++ src/main.c
@@ -730,14 +730,17 @@
730730
**
731731
** List all web pages
732732
*/
733733
void cmd_test_webpage_list(void){
734734
int i, nCmd;
735
- const char *aCmd[count(aWebpage)];
736
- for(i=nCmd=0; i<count(aWebpage); i++){
737
- aCmd[nCmd++] = aWebpage[i].zName;
735
+ const char *aCmd[count(aCommand)];
736
+ for(i=nCmd=0; i<count(aCommand); i++){
737
+ if(0x08 & aCommand[i].cmdFlags){
738
+ aCmd[nCmd++] = aWebpage[i].zName;
739
+ }
738740
}
741
+ assert(nCmd && "page list is empty?");
739742
multi_column_list(aCmd, nCmd);
740743
}
741744
742745
/*
743746
** COMMAND: version
@@ -763,14 +766,17 @@
763766
**
764767
** %fossil help Show common commands
765768
** %fossil help --all Show both common and auxiliary commands
766769
** %fossil help --test Show test commands only
767770
** %fossil help --aux Show auxiliary commands only
771
+** %fossil help --www Show list of WWW pages
768772
*/
769773
void help_cmd(void){
770
- int rc, idx;
774
+ int rc, idx, isPage = 0;
771775
const char *z;
776
+ char const * zCmdOrPage;
777
+ char const * zCmdOrPagePlural;
772778
if( g.argc<3 ){
773779
z = g.argv[0];
774780
fossil_print(
775781
"Usage: %s help COMMAND\n"
776782
"Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
@@ -781,33 +787,46 @@
781787
}
782788
if( find_option("all",0,0) ){
783789
command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
784790
return;
785791
}
786
- if( find_option("aux",0,0) ){
792
+ else if( find_option("www",0,0) ){
793
+ command_list(0, CMDFLAG_WEBPAGE);
794
+ return;
795
+ }
796
+ else if( find_option("aux",0,0) ){
787797
command_list(0, CMDFLAG_2ND_TIER);
788798
return;
789799
}
790
- if( find_option("test",0,0) ){
800
+ else if( find_option("test",0,0) ){
791801
command_list(0, CMDFLAG_TEST);
792802
return;
803
+ }
804
+ isPage = ('/' == *g.argv[2]) ? 1 : 0;
805
+ if(isPage){
806
+ zCmdOrPage = "page";
807
+ zCmdOrPagePlural = "pages";
808
+ }else{
809
+ zCmdOrPage = "command";
810
+ zCmdOrPagePlural = "commands";
793811
}
794812
rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
795813
if( rc==1 ){
796
- fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
797
- command_list(0, 0xff);
814
+ fossil_print("unknown %s: %s\nAvailable %s:\n",
815
+ zCmdOrPage, g.argv[2], zCmdOrPagePlural);
816
+ command_list(0, isPage ? CMDFLAG_WEBPAGE : (0xff & ~CMDFLAG_WEBPAGE));
798817
fossil_exit(1);
799818
}else if( rc==2 ){
800
- fossil_print("ambiguous command prefix: %s\nMatching commands:\n",
801
- g.argv[2]);
819
+ fossil_print("ambiguous %s prefix: %s\nMatching %s:\n",
820
+ zCmdOrPage, g.argv[2], zCmdOrPagePlural);
802821
command_list(g.argv[2], 0xff);
803822
fossil_exit(1);
804823
}
805
- z = aCmdHelp[idx];
824
+ z = aCmdHelp[idx].zText;
806825
if( z==0 ){
807
- fossil_fatal("no help available for the %s command",
808
- aCommand[idx].zName);
826
+ fossil_fatal("no help available for the %s %s",
827
+ aCommand[idx].zName, zCmdOrPage);
809828
}
810829
while( *z ){
811830
if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
812831
fossil_print("%s", g.argv[0]);
813832
z += 7;
@@ -829,20 +848,20 @@
829848
if( zCmd==0 ) zCmd = P("name");
830849
style_header("Command-line Help");
831850
if( zCmd ){
832851
int rc, idx;
833852
char *z, *s, *d;
834
-
853
+ char const * zCmdOrPage = ('/'==*zCmd) ? "page" : "command";
835854
style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
836
- @ <h1>The "%s(zCmd)" command:</h1>
855
+ @ <h1>The "%s(zCmd)" %s(zCmdOrPage):</h1>
837856
rc = name_search(zCmd, aCommand, count(aCommand), &idx);
838857
if( rc==1 ){
839858
@ unknown command: %s(zCmd)
840859
}else if( rc==2 ){
841860
@ ambiguous command prefix: %s(zCmd)
842861
}else{
843
- z = (char*)aCmdHelp[idx];
862
+ z = (char*)aCmdHelp[idx].zText;
844863
if( z==0 ){
845864
@ no help available for the %s(aCommand[idx].zName) command
846865
}else{
847866
z=s=d=mprintf("%s",z);
848867
while( *s ){
@@ -864,21 +883,52 @@
864883
865884
@ <h1>Available commands:</h1>
866885
@ <table border="0"><tr>
867886
for(i=j=0; i<count(aCommand); i++){
868887
const char *z = aCommand[i].zName;
869
- if( strncmp(z,"test",4)==0 ) continue;
888
+ if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
870889
j++;
871890
}
872891
n = (j+6)/7;
873892
for(i=j=0; i<count(aCommand); i++){
874893
const char *z = aCommand[i].zName;
875
- if( strncmp(z,"test",4)==0 ) continue;
894
+ if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
895
+ if( j==0 ){
896
+ @ <td valign="top"><ul>
897
+ }
898
+ @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a></li>
899
+ j++;
900
+ if( j>=n ){
901
+ @ </ul></td>
902
+ j = 0;
903
+ }
904
+ }
905
+ if( j>0 ){
906
+ @ </ul></td>
907
+ }
908
+ @ </tr></table>
909
+
910
+ @ <h1>Available pages:</h1>
911
+ @ (Only pages with help text are linked.)
912
+ @ <table border="0"><tr>
913
+ for(i=j=0; i<count(aCommand); i++){
914
+ const char *z = aCommand[i].zName;
915
+ if( '/'!=*z ) continue;
916
+ j++;
917
+ }
918
+ n = (j+4)/5;
919
+ for(i=j=0; i<count(aCommand); i++){
920
+ const char *z = aCommand[i].zName;
921
+ if( '/'!=*z ) continue;
876922
if( j==0 ){
877923
@ <td valign="top"><ul>
878924
}
879
- @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a>
925
+ if( aCmdHelp[i].zText && *aCmdHelp[i].zText ){
926
+ @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z+1)</a></li>
927
+ }else{
928
+ @ <li>%s(z+1)</li>
929
+ }
880930
j++;
881931
if( j>=n ){
882932
@ </ul></td>
883933
j = 0;
884934
}
@@ -885,10 +935,11 @@
885935
}
886936
if( j>0 ){
887937
@ </ul></td>
888938
}
889939
@ </tr></table>
940
+
890941
}
891942
style_footer();
892943
}
893944
894945
/*
@@ -901,11 +952,11 @@
901952
style_header("Testpage: All Help Text");
902953
for(i=0; i<count(aCommand); i++){
903954
if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
904955
@ <h2>%s(aCommand[i].zName):</h2>
905956
@ <blockquote><pre>
906
- @ %h(aCmdHelp[i])
957
+ @ %h(aCmdHelp[i].zText)
907958
@ </pre></blockquote>
908959
}
909960
style_footer();
910961
}
911962
912963
--- src/main.c
+++ src/main.c
@@ -730,14 +730,17 @@
730 **
731 ** List all web pages
732 */
733 void cmd_test_webpage_list(void){
734 int i, nCmd;
735 const char *aCmd[count(aWebpage)];
736 for(i=nCmd=0; i<count(aWebpage); i++){
737 aCmd[nCmd++] = aWebpage[i].zName;
 
 
738 }
 
739 multi_column_list(aCmd, nCmd);
740 }
741
742 /*
743 ** COMMAND: version
@@ -763,14 +766,17 @@
763 **
764 ** %fossil help Show common commands
765 ** %fossil help --all Show both common and auxiliary commands
766 ** %fossil help --test Show test commands only
767 ** %fossil help --aux Show auxiliary commands only
 
768 */
769 void help_cmd(void){
770 int rc, idx;
771 const char *z;
 
 
772 if( g.argc<3 ){
773 z = g.argv[0];
774 fossil_print(
775 "Usage: %s help COMMAND\n"
776 "Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
@@ -781,33 +787,46 @@
781 }
782 if( find_option("all",0,0) ){
783 command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
784 return;
785 }
786 if( find_option("aux",0,0) ){
 
 
 
 
787 command_list(0, CMDFLAG_2ND_TIER);
788 return;
789 }
790 if( find_option("test",0,0) ){
791 command_list(0, CMDFLAG_TEST);
792 return;
 
 
 
 
 
 
 
 
793 }
794 rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
795 if( rc==1 ){
796 fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
797 command_list(0, 0xff);
 
798 fossil_exit(1);
799 }else if( rc==2 ){
800 fossil_print("ambiguous command prefix: %s\nMatching commands:\n",
801 g.argv[2]);
802 command_list(g.argv[2], 0xff);
803 fossil_exit(1);
804 }
805 z = aCmdHelp[idx];
806 if( z==0 ){
807 fossil_fatal("no help available for the %s command",
808 aCommand[idx].zName);
809 }
810 while( *z ){
811 if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
812 fossil_print("%s", g.argv[0]);
813 z += 7;
@@ -829,20 +848,20 @@
829 if( zCmd==0 ) zCmd = P("name");
830 style_header("Command-line Help");
831 if( zCmd ){
832 int rc, idx;
833 char *z, *s, *d;
834
835 style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
836 @ <h1>The "%s(zCmd)" command:</h1>
837 rc = name_search(zCmd, aCommand, count(aCommand), &idx);
838 if( rc==1 ){
839 @ unknown command: %s(zCmd)
840 }else if( rc==2 ){
841 @ ambiguous command prefix: %s(zCmd)
842 }else{
843 z = (char*)aCmdHelp[idx];
844 if( z==0 ){
845 @ no help available for the %s(aCommand[idx].zName) command
846 }else{
847 z=s=d=mprintf("%s",z);
848 while( *s ){
@@ -864,21 +883,52 @@
864
865 @ <h1>Available commands:</h1>
866 @ <table border="0"><tr>
867 for(i=j=0; i<count(aCommand); i++){
868 const char *z = aCommand[i].zName;
869 if( strncmp(z,"test",4)==0 ) continue;
870 j++;
871 }
872 n = (j+6)/7;
873 for(i=j=0; i<count(aCommand); i++){
874 const char *z = aCommand[i].zName;
875 if( strncmp(z,"test",4)==0 ) continue;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
876 if( j==0 ){
877 @ <td valign="top"><ul>
878 }
879 @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a>
 
 
 
 
880 j++;
881 if( j>=n ){
882 @ </ul></td>
883 j = 0;
884 }
@@ -885,10 +935,11 @@
885 }
886 if( j>0 ){
887 @ </ul></td>
888 }
889 @ </tr></table>
 
890 }
891 style_footer();
892 }
893
894 /*
@@ -901,11 +952,11 @@
901 style_header("Testpage: All Help Text");
902 for(i=0; i<count(aCommand); i++){
903 if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
904 @ <h2>%s(aCommand[i].zName):</h2>
905 @ <blockquote><pre>
906 @ %h(aCmdHelp[i])
907 @ </pre></blockquote>
908 }
909 style_footer();
910 }
911
912
--- src/main.c
+++ src/main.c
@@ -730,14 +730,17 @@
730 **
731 ** List all web pages
732 */
733 void cmd_test_webpage_list(void){
734 int i, nCmd;
735 const char *aCmd[count(aCommand)];
736 for(i=nCmd=0; i<count(aCommand); i++){
737 if(0x08 & aCommand[i].cmdFlags){
738 aCmd[nCmd++] = aWebpage[i].zName;
739 }
740 }
741 assert(nCmd && "page list is empty?");
742 multi_column_list(aCmd, nCmd);
743 }
744
745 /*
746 ** COMMAND: version
@@ -763,14 +766,17 @@
766 **
767 ** %fossil help Show common commands
768 ** %fossil help --all Show both common and auxiliary commands
769 ** %fossil help --test Show test commands only
770 ** %fossil help --aux Show auxiliary commands only
771 ** %fossil help --www Show list of WWW pages
772 */
773 void help_cmd(void){
774 int rc, idx, isPage = 0;
775 const char *z;
776 char const * zCmdOrPage;
777 char const * zCmdOrPagePlural;
778 if( g.argc<3 ){
779 z = g.argv[0];
780 fossil_print(
781 "Usage: %s help COMMAND\n"
782 "Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
@@ -781,33 +787,46 @@
787 }
788 if( find_option("all",0,0) ){
789 command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
790 return;
791 }
792 else if( find_option("www",0,0) ){
793 command_list(0, CMDFLAG_WEBPAGE);
794 return;
795 }
796 else if( find_option("aux",0,0) ){
797 command_list(0, CMDFLAG_2ND_TIER);
798 return;
799 }
800 else if( find_option("test",0,0) ){
801 command_list(0, CMDFLAG_TEST);
802 return;
803 }
804 isPage = ('/' == *g.argv[2]) ? 1 : 0;
805 if(isPage){
806 zCmdOrPage = "page";
807 zCmdOrPagePlural = "pages";
808 }else{
809 zCmdOrPage = "command";
810 zCmdOrPagePlural = "commands";
811 }
812 rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
813 if( rc==1 ){
814 fossil_print("unknown %s: %s\nAvailable %s:\n",
815 zCmdOrPage, g.argv[2], zCmdOrPagePlural);
816 command_list(0, isPage ? CMDFLAG_WEBPAGE : (0xff & ~CMDFLAG_WEBPAGE));
817 fossil_exit(1);
818 }else if( rc==2 ){
819 fossil_print("ambiguous %s prefix: %s\nMatching %s:\n",
820 zCmdOrPage, g.argv[2], zCmdOrPagePlural);
821 command_list(g.argv[2], 0xff);
822 fossil_exit(1);
823 }
824 z = aCmdHelp[idx].zText;
825 if( z==0 ){
826 fossil_fatal("no help available for the %s %s",
827 aCommand[idx].zName, zCmdOrPage);
828 }
829 while( *z ){
830 if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
831 fossil_print("%s", g.argv[0]);
832 z += 7;
@@ -829,20 +848,20 @@
848 if( zCmd==0 ) zCmd = P("name");
849 style_header("Command-line Help");
850 if( zCmd ){
851 int rc, idx;
852 char *z, *s, *d;
853 char const * zCmdOrPage = ('/'==*zCmd) ? "page" : "command";
854 style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
855 @ <h1>The "%s(zCmd)" %s(zCmdOrPage):</h1>
856 rc = name_search(zCmd, aCommand, count(aCommand), &idx);
857 if( rc==1 ){
858 @ unknown command: %s(zCmd)
859 }else if( rc==2 ){
860 @ ambiguous command prefix: %s(zCmd)
861 }else{
862 z = (char*)aCmdHelp[idx].zText;
863 if( z==0 ){
864 @ no help available for the %s(aCommand[idx].zName) command
865 }else{
866 z=s=d=mprintf("%s",z);
867 while( *s ){
@@ -864,21 +883,52 @@
883
884 @ <h1>Available commands:</h1>
885 @ <table border="0"><tr>
886 for(i=j=0; i<count(aCommand); i++){
887 const char *z = aCommand[i].zName;
888 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
889 j++;
890 }
891 n = (j+6)/7;
892 for(i=j=0; i<count(aCommand); i++){
893 const char *z = aCommand[i].zName;
894 if( '/'==*z || strncmp(z,"test",4)==0 ) continue;
895 if( j==0 ){
896 @ <td valign="top"><ul>
897 }
898 @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a></li>
899 j++;
900 if( j>=n ){
901 @ </ul></td>
902 j = 0;
903 }
904 }
905 if( j>0 ){
906 @ </ul></td>
907 }
908 @ </tr></table>
909
910 @ <h1>Available pages:</h1>
911 @ (Only pages with help text are linked.)
912 @ <table border="0"><tr>
913 for(i=j=0; i<count(aCommand); i++){
914 const char *z = aCommand[i].zName;
915 if( '/'!=*z ) continue;
916 j++;
917 }
918 n = (j+4)/5;
919 for(i=j=0; i<count(aCommand); i++){
920 const char *z = aCommand[i].zName;
921 if( '/'!=*z ) continue;
922 if( j==0 ){
923 @ <td valign="top"><ul>
924 }
925 if( aCmdHelp[i].zText && *aCmdHelp[i].zText ){
926 @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z+1)</a></li>
927 }else{
928 @ <li>%s(z+1)</li>
929 }
930 j++;
931 if( j>=n ){
932 @ </ul></td>
933 j = 0;
934 }
@@ -885,10 +935,11 @@
935 }
936 if( j>0 ){
937 @ </ul></td>
938 }
939 @ </tr></table>
940
941 }
942 style_footer();
943 }
944
945 /*
@@ -901,11 +952,11 @@
952 style_header("Testpage: All Help Text");
953 for(i=0; i<count(aCommand); i++){
954 if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
955 @ <h2>%s(aCommand[i].zName):</h2>
956 @ <blockquote><pre>
957 @ %h(aCmdHelp[i].zText)
958 @ </pre></blockquote>
959 }
960 style_footer();
961 }
962
963
+22 -17
--- src/mkindex.c
+++ src/mkindex.c
@@ -174,10 +174,11 @@
174174
if( strncmp(zLine, "**", 2)==0
175175
&& isspace(zLine[2])
176176
&& strlen(zLine)<sizeof(zHelp)-nHelp-1
177177
&& nUsed>nFixed
178178
&& memcmp(zLine,"** COMMAND:",11)!=0
179
+ && memcmp(zLine,"** WEBPAGE:",11)!=0
179180
){
180181
if( zLine[2]=='\n' ){
181182
zHelp[nHelp++] = '\n';
182183
}else{
183184
if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
@@ -242,11 +243,10 @@
242243
/*
243244
** Build the binary search table.
244245
*/
245246
void build_table(void){
246247
int i;
247
- int nType0;
248248
249249
qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare);
250250
for(i=0; i<nFixed; i++){
251251
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
252252
printf("extern void %s(void);\n", aEntry[i].zFunc);
@@ -260,10 +260,11 @@
260260
" char cmdFlags;\n"
261261
"};\n"
262262
"#define CMDFLAG_1ST_TIER 0x01\n"
263263
"#define CMDFLAG_2ND_TIER 0x02\n"
264264
"#define CMDFLAG_TEST 0x04\n"
265
+ "#define CMDFLAG_WEBPAGE 0x08\n"
265266
"static const NameMap aWebpage[] = {\n"
266267
);
267268
for(i=0; i<nFixed && aEntry[i].eType==0; i++){
268269
const char *z = aEntry[i].zPath;
269270
int n = strlen(z);
@@ -275,36 +276,38 @@
275276
(int)(35-strlen(aEntry[i].zFunc)), ""
276277
);
277278
if( aEntry[i].zIf ) printf("#endif\n");
278279
}
279280
printf("};\n");
280
- nType0 = i;
281281
printf(
282282
"static const NameMap aCommand[] = {\n"
283283
);
284
- for(i=nType0; i<nFixed && aEntry[i].eType==1; i++){
284
+ for(i=0; i<nFixed /*&& aEntry[i].eType==1*/; i++){
285285
const char *z = aEntry[i].zPath;
286286
int n = strlen(z);
287
- int cmdFlags = 0x01;
288
- if( z[n-1]=='*' ){
289
- n--;
290
- cmdFlags = 0x02;
291
- }else if( memcmp(z, "test-", 5)==0 ){
292
- cmdFlags = 0x04;
287
+ int cmdFlags = (1==aEntry[i].eType) ? 0x01 : 0x08;
288
+ if(0x01==cmdFlags){
289
+ if( z[n-1]=='*' ){
290
+ n--;
291
+ cmdFlags = 0x02;
292
+ }else if( memcmp(z, "test-", 5)==0 ){
293
+ cmdFlags = 0x04;
294
+ }
293295
}
294296
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
295
- printf(" { \"%.*s\",%*s %s,%*s %d },\n",
297
+ printf(" { \"%s%.*s\",%*s %s,%*s %d },\n",
298
+ (0x08 & cmdFlags) ? "/" : "",
296299
n, z,
297300
25-n, "",
298301
aEntry[i].zFunc,
299302
(int)(35-strlen(aEntry[i].zFunc)), "",
300303
cmdFlags
301304
);
302305
if( aEntry[i].zIf ) printf("#endif\n");
303306
}
304307
printf("};\n");
305
- for(i=nType0; i<nFixed; i++){
308
+ for(i=0; i<nFixed; i++){
306309
char *z = aEntry[i].zHelp;
307310
if( z && z[0] ){
308311
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
309312
printf("static const char zHelp_%s[] = \n", aEntry[i].zFunc);
310313
printf(" \"");
@@ -321,19 +324,21 @@
321324
printf("\";\n");
322325
if( aEntry[i].zIf ) printf("#endif\n");
323326
aEntry[i].zHelp[0] = 0;
324327
}
325328
}
326
- printf(
327
- "static const char * const aCmdHelp[] = {\n"
328
- );
329
- for(i=nType0; i<nFixed; i++){
329
+ puts("struct CmdHelp {"
330
+ "int eType; "
331
+ "char const * zText;"
332
+ "};");
333
+ puts("static struct CmdHelp aCmdHelp[] = {");
334
+ for(i=0; i<nFixed; i++){
330335
if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
331336
if( aEntry[i].zHelp==0 ){
332
- printf(" 0,\n");
337
+ printf("{%d, 0},\n", aEntry[i].eType);
333338
}else{
334
- printf(" zHelp_%s,\n", aEntry[i].zFunc);
339
+ printf("{%d, zHelp_%s},\n", aEntry[i].eType, aEntry[i].zFunc);
335340
}
336341
if( aEntry[i].zIf ) printf("#endif\n");
337342
}
338343
printf("};\n");
339344
}
340345
--- src/mkindex.c
+++ src/mkindex.c
@@ -174,10 +174,11 @@
174 if( strncmp(zLine, "**", 2)==0
175 && isspace(zLine[2])
176 && strlen(zLine)<sizeof(zHelp)-nHelp-1
177 && nUsed>nFixed
178 && memcmp(zLine,"** COMMAND:",11)!=0
 
179 ){
180 if( zLine[2]=='\n' ){
181 zHelp[nHelp++] = '\n';
182 }else{
183 if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
@@ -242,11 +243,10 @@
242 /*
243 ** Build the binary search table.
244 */
245 void build_table(void){
246 int i;
247 int nType0;
248
249 qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare);
250 for(i=0; i<nFixed; i++){
251 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
252 printf("extern void %s(void);\n", aEntry[i].zFunc);
@@ -260,10 +260,11 @@
260 " char cmdFlags;\n"
261 "};\n"
262 "#define CMDFLAG_1ST_TIER 0x01\n"
263 "#define CMDFLAG_2ND_TIER 0x02\n"
264 "#define CMDFLAG_TEST 0x04\n"
 
265 "static const NameMap aWebpage[] = {\n"
266 );
267 for(i=0; i<nFixed && aEntry[i].eType==0; i++){
268 const char *z = aEntry[i].zPath;
269 int n = strlen(z);
@@ -275,36 +276,38 @@
275 (int)(35-strlen(aEntry[i].zFunc)), ""
276 );
277 if( aEntry[i].zIf ) printf("#endif\n");
278 }
279 printf("};\n");
280 nType0 = i;
281 printf(
282 "static const NameMap aCommand[] = {\n"
283 );
284 for(i=nType0; i<nFixed && aEntry[i].eType==1; i++){
285 const char *z = aEntry[i].zPath;
286 int n = strlen(z);
287 int cmdFlags = 0x01;
288 if( z[n-1]=='*' ){
289 n--;
290 cmdFlags = 0x02;
291 }else if( memcmp(z, "test-", 5)==0 ){
292 cmdFlags = 0x04;
 
 
293 }
294 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
295 printf(" { \"%.*s\",%*s %s,%*s %d },\n",
 
296 n, z,
297 25-n, "",
298 aEntry[i].zFunc,
299 (int)(35-strlen(aEntry[i].zFunc)), "",
300 cmdFlags
301 );
302 if( aEntry[i].zIf ) printf("#endif\n");
303 }
304 printf("};\n");
305 for(i=nType0; i<nFixed; i++){
306 char *z = aEntry[i].zHelp;
307 if( z && z[0] ){
308 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
309 printf("static const char zHelp_%s[] = \n", aEntry[i].zFunc);
310 printf(" \"");
@@ -321,19 +324,21 @@
321 printf("\";\n");
322 if( aEntry[i].zIf ) printf("#endif\n");
323 aEntry[i].zHelp[0] = 0;
324 }
325 }
326 printf(
327 "static const char * const aCmdHelp[] = {\n"
328 );
329 for(i=nType0; i<nFixed; i++){
 
 
330 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
331 if( aEntry[i].zHelp==0 ){
332 printf(" 0,\n");
333 }else{
334 printf(" zHelp_%s,\n", aEntry[i].zFunc);
335 }
336 if( aEntry[i].zIf ) printf("#endif\n");
337 }
338 printf("};\n");
339 }
340
--- src/mkindex.c
+++ src/mkindex.c
@@ -174,10 +174,11 @@
174 if( strncmp(zLine, "**", 2)==0
175 && isspace(zLine[2])
176 && strlen(zLine)<sizeof(zHelp)-nHelp-1
177 && nUsed>nFixed
178 && memcmp(zLine,"** COMMAND:",11)!=0
179 && memcmp(zLine,"** WEBPAGE:",11)!=0
180 ){
181 if( zLine[2]=='\n' ){
182 zHelp[nHelp++] = '\n';
183 }else{
184 if( strncmp(&zLine[3], "Usage: ", 6)==0 ) nHelp = 0;
@@ -242,11 +243,10 @@
243 /*
244 ** Build the binary search table.
245 */
246 void build_table(void){
247 int i;
 
248
249 qsort(aEntry, nFixed, sizeof(aEntry[0]), e_compare);
250 for(i=0; i<nFixed; i++){
251 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
252 printf("extern void %s(void);\n", aEntry[i].zFunc);
@@ -260,10 +260,11 @@
260 " char cmdFlags;\n"
261 "};\n"
262 "#define CMDFLAG_1ST_TIER 0x01\n"
263 "#define CMDFLAG_2ND_TIER 0x02\n"
264 "#define CMDFLAG_TEST 0x04\n"
265 "#define CMDFLAG_WEBPAGE 0x08\n"
266 "static const NameMap aWebpage[] = {\n"
267 );
268 for(i=0; i<nFixed && aEntry[i].eType==0; i++){
269 const char *z = aEntry[i].zPath;
270 int n = strlen(z);
@@ -275,36 +276,38 @@
276 (int)(35-strlen(aEntry[i].zFunc)), ""
277 );
278 if( aEntry[i].zIf ) printf("#endif\n");
279 }
280 printf("};\n");
 
281 printf(
282 "static const NameMap aCommand[] = {\n"
283 );
284 for(i=0; i<nFixed /*&& aEntry[i].eType==1*/; i++){
285 const char *z = aEntry[i].zPath;
286 int n = strlen(z);
287 int cmdFlags = (1==aEntry[i].eType) ? 0x01 : 0x08;
288 if(0x01==cmdFlags){
289 if( z[n-1]=='*' ){
290 n--;
291 cmdFlags = 0x02;
292 }else if( memcmp(z, "test-", 5)==0 ){
293 cmdFlags = 0x04;
294 }
295 }
296 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
297 printf(" { \"%s%.*s\",%*s %s,%*s %d },\n",
298 (0x08 & cmdFlags) ? "/" : "",
299 n, z,
300 25-n, "",
301 aEntry[i].zFunc,
302 (int)(35-strlen(aEntry[i].zFunc)), "",
303 cmdFlags
304 );
305 if( aEntry[i].zIf ) printf("#endif\n");
306 }
307 printf("};\n");
308 for(i=0; i<nFixed; i++){
309 char *z = aEntry[i].zHelp;
310 if( z && z[0] ){
311 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
312 printf("static const char zHelp_%s[] = \n", aEntry[i].zFunc);
313 printf(" \"");
@@ -321,19 +324,21 @@
324 printf("\";\n");
325 if( aEntry[i].zIf ) printf("#endif\n");
326 aEntry[i].zHelp[0] = 0;
327 }
328 }
329 puts("struct CmdHelp {"
330 "int eType; "
331 "char const * zText;"
332 "};");
333 puts("static struct CmdHelp aCmdHelp[] = {");
334 for(i=0; i<nFixed; i++){
335 if( aEntry[i].zIf ) printf("%s", aEntry[i].zIf);
336 if( aEntry[i].zHelp==0 ){
337 printf("{%d, 0},\n", aEntry[i].eType);
338 }else{
339 printf("{%d, zHelp_%s},\n", aEntry[i].eType, aEntry[i].zFunc);
340 }
341 if( aEntry[i].zIf ) printf("#endif\n");
342 }
343 printf("};\n");
344 }
345
+1 -1
--- src/rss.c
+++ src/rss.c
@@ -22,11 +22,11 @@
2222
#include "rss.h"
2323
#include <assert.h>
2424
2525
/*
2626
** WEBPAGE: timeline.rss
27
-** URL: /timeline.rss/y=TYPE&n=LIMIT&tkt=UUID&tag=TAG&wiki=NAME&name=FILENAME
27
+** URL: /timeline.rss?y=TYPE&n=LIMIT&tkt=UUID&tag=TAG&wiki=NAME&name=FILENAME
2828
**
2929
** Produce an RSS feed of the timeline.
3030
**
3131
** TYPE may be: all, ci (show checkins only), t (show tickets only),
3232
** w (show wiki only). LIMIT is the number of items to show.
3333
--- src/rss.c
+++ src/rss.c
@@ -22,11 +22,11 @@
22 #include "rss.h"
23 #include <assert.h>
24
25 /*
26 ** WEBPAGE: timeline.rss
27 ** URL: /timeline.rss/y=TYPE&n=LIMIT&tkt=UUID&tag=TAG&wiki=NAME&name=FILENAME
28 **
29 ** Produce an RSS feed of the timeline.
30 **
31 ** TYPE may be: all, ci (show checkins only), t (show tickets only),
32 ** w (show wiki only). LIMIT is the number of items to show.
33
--- src/rss.c
+++ src/rss.c
@@ -22,11 +22,11 @@
22 #include "rss.h"
23 #include <assert.h>
24
25 /*
26 ** WEBPAGE: timeline.rss
27 ** URL: /timeline.rss?y=TYPE&n=LIMIT&tkt=UUID&tag=TAG&wiki=NAME&name=FILENAME
28 **
29 ** Produce an RSS feed of the timeline.
30 **
31 ** TYPE may be: all, ci (show checkins only), t (show tickets only),
32 ** w (show wiki only). LIMIT is the number of items to show.
33

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button