Fossil

Check-in [26e269fe]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the /test-all-help webpage used for testing.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:26e269fef30b5134c7e02097057cdc348dcb2fa1
User & Date: drh 2011-01-01 00:15:54
Context
2011-01-01
03:06
Updates to header-comment documentation for the mkindex utility program. Fix a compiler warning on windows builds. check-in: 79b7902c user: drh tags: trunk, release
00:15
Add the /test-all-help webpage used for testing. check-in: 26e269fe user: drh tags: trunk
2010-12-31
21:12
Documentation updates. check-in: 5fb963ab user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/main.c.

681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752


















753
754
755
756
757
758
759
}

/*
** WEBPAGE: help
** URL: /help/CMD
*/
void help_page(void){
    const char * zCmd = P("cmd");

    if( zCmd==0 ) zCmd = P("name");
    style_header("Command-line Help");
    if( zCmd ){
      int rc, idx;
      char *z, *s, *d;

      style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
      @ <h1>The "%s(zCmd)" command:</h1>
      rc = name_search(zCmd, aCommand, count(aCommand), &idx);
      if( rc==1 ){
        @ unknown command: %s(zCmd)
      }else if( rc==2 ){
        @ ambiguous command prefix: %s(zCmd)
      }else{
        z = (char*)aCmdHelp[idx];
        if( z==0 ){
          @ no help available for the %s(aCommand[idx].zName) command
        }else{
          z=s=d=mprintf("%s",z);
	  while( *s ){
	    if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){
	      s++;
	    }else{
	      *d++ = *s++;
	    }
	  }
	  *d = 0;
	  @ <blockquote><pre>
          @ %h(z)
          @ </pre></blockquote>
	  free(z);
	}
      }
    }else{
      int i, j, n;

      @ <h1>Available commands:</h1>
      @ <table border="0"><tr>
      for(i=j=0; i<count(aCommand); i++){
        const char *z = aCommand[i].zName;
        if( strncmp(z,"test",4)==0 ) continue;
        j++;
      }
      n = (j+6)/7;
      for(i=j=0; i<count(aCommand); i++){
        const char *z = aCommand[i].zName;
        if( strncmp(z,"test",4)==0 ) continue;
        if( j==0 ){
          @ <td valign="top"><ul>
        }
        @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a>
        j++;
        if( j>=n ){
          @ </ul></td>
          j = 0;
        }
      }
      if( j>0 ){
        @ </ul></td>
      }
      @ </tr></table>
    }
    style_footer();


















}

/*
** Set the g.zBaseURL value to the full URL for the toplevel of
** the fossil tree.  Set g.zTop to g.zBaseURL without the
** leading "http://" and the host and port.
*/







|

|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|

|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
}

/*
** WEBPAGE: help
** URL: /help/CMD
*/
void help_page(void){
  const char * zCmd = P("cmd");

  if( zCmd==0 ) zCmd = P("name");
  style_header("Command-line Help");
  if( zCmd ){
    int rc, idx;
    char *z, *s, *d;

    style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop);
    @ <h1>The "%s(zCmd)" command:</h1>
    rc = name_search(zCmd, aCommand, count(aCommand), &idx);
    if( rc==1 ){
      @ unknown command: %s(zCmd)
    }else if( rc==2 ){
      @ ambiguous command prefix: %s(zCmd)
    }else{
      z = (char*)aCmdHelp[idx];
      if( z==0 ){
        @ no help available for the %s(aCommand[idx].zName) command
      }else{
        z=s=d=mprintf("%s",z);
        while( *s ){
          if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){
            s++;
          }else{
            *d++ = *s++;
          }
        }
        *d = 0;
        @ <blockquote><pre>
        @ %h(z)
        @ </pre></blockquote>
        free(z);
      }
    }
  }else{
    int i, j, n;

    @ <h1>Available commands:</h1>
    @ <table border="0"><tr>
    for(i=j=0; i<count(aCommand); i++){
      const char *z = aCommand[i].zName;
      if( strncmp(z,"test",4)==0 ) continue;
      j++;
    }
    n = (j+6)/7;
    for(i=j=0; i<count(aCommand); i++){
      const char *z = aCommand[i].zName;
      if( strncmp(z,"test",4)==0 ) continue;
      if( j==0 ){
        @ <td valign="top"><ul>
      }
      @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a>
      j++;
      if( j>=n ){
        @ </ul></td>
        j = 0;
      }
    }
    if( j>0 ){
      @ </ul></td>
    }
    @ </tr></table>
  }
  style_footer();
}

/*
** WEBPAGE: test-all-help
**
** Show all help text on a single page.  Useful for proof-reading.
*/
void test_all_help_page(void){
  int i;
  style_header("Testpage: All Help Text");
  for(i=0; i<count(aCommand); i++){
    if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue;
    @ <h2>%s(aCommand[i].zName):</h2>
    @ <blockquote><pre>
    @ %h(aCmdHelp[i])
    @ </pre></blockquote>
  }
  style_footer();
}

/*
** Set the g.zBaseURL value to the full URL for the toplevel of
** the fossil tree.  Set g.zTop to g.zBaseURL without the
** leading "http://" and the host and port.
*/