| | @@ -683,75 +683,93 @@ |
| 683 | 683 | /* |
| 684 | 684 | ** WEBPAGE: help |
| 685 | 685 | ** URL: /help/CMD |
| 686 | 686 | */ |
| 687 | 687 | void help_page(void){ |
| 688 | | - const char * zCmd = P("cmd"); |
| 689 | | - |
| 690 | | - if( zCmd==0 ) zCmd = P("name"); |
| 691 | | - style_header("Command-line Help"); |
| 692 | | - if( zCmd ){ |
| 693 | | - int rc, idx; |
| 694 | | - char *z, *s, *d; |
| 695 | | - |
| 696 | | - style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop); |
| 697 | | - @ <h1>The "%s(zCmd)" command:</h1> |
| 698 | | - rc = name_search(zCmd, aCommand, count(aCommand), &idx); |
| 699 | | - if( rc==1 ){ |
| 700 | | - @ unknown command: %s(zCmd) |
| 701 | | - }else if( rc==2 ){ |
| 702 | | - @ ambiguous command prefix: %s(zCmd) |
| 703 | | - }else{ |
| 704 | | - z = (char*)aCmdHelp[idx]; |
| 705 | | - if( z==0 ){ |
| 706 | | - @ no help available for the %s(aCommand[idx].zName) command |
| 707 | | - }else{ |
| 708 | | - z=s=d=mprintf("%s",z); |
| 709 | | - while( *s ){ |
| 710 | | - if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){ |
| 711 | | - s++; |
| 712 | | - }else{ |
| 713 | | - *d++ = *s++; |
| 714 | | - } |
| 715 | | - } |
| 716 | | - *d = 0; |
| 717 | | - @ <blockquote><pre> |
| 718 | | - @ %h(z) |
| 719 | | - @ </pre></blockquote> |
| 720 | | - free(z); |
| 721 | | - } |
| 722 | | - } |
| 723 | | - }else{ |
| 724 | | - int i, j, n; |
| 725 | | - |
| 726 | | - @ <h1>Available commands:</h1> |
| 727 | | - @ <table border="0"><tr> |
| 728 | | - for(i=j=0; i<count(aCommand); i++){ |
| 729 | | - const char *z = aCommand[i].zName; |
| 730 | | - if( strncmp(z,"test",4)==0 ) continue; |
| 731 | | - j++; |
| 732 | | - } |
| 733 | | - n = (j+6)/7; |
| 734 | | - for(i=j=0; i<count(aCommand); i++){ |
| 735 | | - const char *z = aCommand[i].zName; |
| 736 | | - if( strncmp(z,"test",4)==0 ) continue; |
| 737 | | - if( j==0 ){ |
| 738 | | - @ <td valign="top"><ul> |
| 739 | | - } |
| 740 | | - @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a> |
| 741 | | - j++; |
| 742 | | - if( j>=n ){ |
| 743 | | - @ </ul></td> |
| 744 | | - j = 0; |
| 745 | | - } |
| 746 | | - } |
| 747 | | - if( j>0 ){ |
| 748 | | - @ </ul></td> |
| 749 | | - } |
| 750 | | - @ </tr></table> |
| 751 | | - } |
| 752 | | - style_footer(); |
| 688 | + const char * zCmd = P("cmd"); |
| 689 | + |
| 690 | + if( zCmd==0 ) zCmd = P("name"); |
| 691 | + style_header("Command-line Help"); |
| 692 | + if( zCmd ){ |
| 693 | + int rc, idx; |
| 694 | + char *z, *s, *d; |
| 695 | + |
| 696 | + style_submenu_element("Command-List", "Command-List", "%s/help", g.zTop); |
| 697 | + @ <h1>The "%s(zCmd)" command:</h1> |
| 698 | + rc = name_search(zCmd, aCommand, count(aCommand), &idx); |
| 699 | + if( rc==1 ){ |
| 700 | + @ unknown command: %s(zCmd) |
| 701 | + }else if( rc==2 ){ |
| 702 | + @ ambiguous command prefix: %s(zCmd) |
| 703 | + }else{ |
| 704 | + z = (char*)aCmdHelp[idx]; |
| 705 | + if( z==0 ){ |
| 706 | + @ no help available for the %s(aCommand[idx].zName) command |
| 707 | + }else{ |
| 708 | + z=s=d=mprintf("%s",z); |
| 709 | + while( *s ){ |
| 710 | + if( *s=='%' && strncmp(s, "%fossil", 7)==0 ){ |
| 711 | + s++; |
| 712 | + }else{ |
| 713 | + *d++ = *s++; |
| 714 | + } |
| 715 | + } |
| 716 | + *d = 0; |
| 717 | + @ <blockquote><pre> |
| 718 | + @ %h(z) |
| 719 | + @ </pre></blockquote> |
| 720 | + free(z); |
| 721 | + } |
| 722 | + } |
| 723 | + }else{ |
| 724 | + int i, j, n; |
| 725 | + |
| 726 | + @ <h1>Available commands:</h1> |
| 727 | + @ <table border="0"><tr> |
| 728 | + for(i=j=0; i<count(aCommand); i++){ |
| 729 | + const char *z = aCommand[i].zName; |
| 730 | + if( strncmp(z,"test",4)==0 ) continue; |
| 731 | + j++; |
| 732 | + } |
| 733 | + n = (j+6)/7; |
| 734 | + for(i=j=0; i<count(aCommand); i++){ |
| 735 | + const char *z = aCommand[i].zName; |
| 736 | + if( strncmp(z,"test",4)==0 ) continue; |
| 737 | + if( j==0 ){ |
| 738 | + @ <td valign="top"><ul> |
| 739 | + } |
| 740 | + @ <li><a href="%s(g.zTop)/help?cmd=%s(z)">%s(z)</a> |
| 741 | + j++; |
| 742 | + if( j>=n ){ |
| 743 | + @ </ul></td> |
| 744 | + j = 0; |
| 745 | + } |
| 746 | + } |
| 747 | + if( j>0 ){ |
| 748 | + @ </ul></td> |
| 749 | + } |
| 750 | + @ </tr></table> |
| 751 | + } |
| 752 | + style_footer(); |
| 753 | +} |
| 754 | + |
| 755 | +/* |
| 756 | +** WEBPAGE: test-all-help |
| 757 | +** |
| 758 | +** Show all help text on a single page. Useful for proof-reading. |
| 759 | +*/ |
| 760 | +void test_all_help_page(void){ |
| 761 | + int i; |
| 762 | + style_header("Testpage: All Help Text"); |
| 763 | + for(i=0; i<count(aCommand); i++){ |
| 764 | + if( memcmp(aCommand[i].zName, "test", 4)==0 ) continue; |
| 765 | + @ <h2>%s(aCommand[i].zName):</h2> |
| 766 | + @ <blockquote><pre> |
| 767 | + @ %h(aCmdHelp[i]) |
| 768 | + @ </pre></blockquote> |
| 769 | + } |
| 770 | + style_footer(); |
| 753 | 771 | } |
| 754 | 772 | |
| 755 | 773 | /* |
| 756 | 774 | ** Set the g.zBaseURL value to the full URL for the toplevel of |
| 757 | 775 | ** the fossil tree. Set g.zTop to g.zBaseURL without the |
| 758 | 776 | |