641
642
643
644
645
646
647
648
649
650
651
652
653
654
|
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
|
+
+
+
+
+
+
+
+
+
+
|
/*
** WEBPAGE: help
** URL: /help?name=CMD
**
** Show the built-in help text for CMD. CMD can be a command-line interface
** command or a page name from the web interface or a setting.
** Query parameters:
**
** name=CMD Show help for CMD where CMD is a command name or
** webpage name or setting name.
**
** plaintext Show the help within <pre>...</pre>, as if it were
** displayed using the "fossil help" command.
**
** raw Show the raw help text without any formatting.
** (Used for debugging.)
*/
void help_page(void){
const char *zCmd = P("cmd");
if( zCmd==0 ) zCmd = P("name");
if( zCmd && *zCmd ){
int rc;
|
670
671
672
673
674
675
676
677
678
679
680
681
682
683
|
680
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
|
+
+
+
+
+
+
+
+
+
+
+
+
|
if( rc==1 ){
@ unknown command: %h(zCmd)
}else if( rc==2 ){
@ ambiguous command prefix: %h(zCmd)
}else{
if( pCmd->zHelp[0]==0 ){
@ No help available for "%h(pCmd->zName)"
}else if( P("plaintext") ){
Blob txt;
blob_init(&txt, 0, 0);
help_to_text(pCmd->zHelp, &txt);
@ <pre class="helpPage">
@ %h(blob_str(&txt))
@ </pre>
blob_reset(&txt);
}else if( P("raw") ){
@ <pre class="helpPage">
@ %h(pCmd->zHelp)
@ </pre>
}else{
@ <div class="helpPage">
help_to_html(pCmd->zHelp, cgi_output_blob());
@ </div>
}
}
}else{
|