931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
|
/*
** COMMAND: test-list-webpage
**
** List all web pages
*/
void cmd_test_webpage_list(void){
int i, nCmd;
const char *aCmd[count(aWebpage)];
for(i=nCmd=0; i<count(aWebpage); i++){
aCmd[nCmd++] = aWebpage[i].zName;
}
multi_column_list(aCmd, nCmd);
}
/*
** COMMAND: version
**
** Usage: %fossil version
|
|
|
>
|
|
>
>
|
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
|
/*
** COMMAND: test-list-webpage
**
** List all web pages
*/
void cmd_test_webpage_list(void){
int i, nCmd;
const char *aCmd[count(aCommand)];
for(i=nCmd=0; i<count(aCommand); i++){
if(0x08 & aCommand[i].cmdFlags){
aCmd[nCmd++] = aWebpage[i].zName;
}
}
assert(nCmd && "page list is empty?");
multi_column_list(aCmd, nCmd);
}
/*
** COMMAND: version
**
** Usage: %fossil version
|
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
|
** Display information on how to use COMMAND. To display a list of
** available commands one of:
**
** %fossil help Show common commands
** %fossil help --all Show both common and auxiliary commands
** %fossil help --test Show test commands only
** %fossil help --aux Show auxiliary commands only
*/
void help_cmd(void){
int rc, idx;
const char *z;
if( g.argc<3 ){
z = g.argv[0];
fossil_print(
"Usage: %s help COMMAND\n"
"Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
z, z);
command_list(0, CMDFLAG_1ST_TIER);
version_cmd();
return;
}
if( find_option("all",0,0) ){
command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
return;
}
if( find_option("aux",0,0) ){
command_list(0, CMDFLAG_2ND_TIER);
return;
}
if( find_option("test",0,0) ){
command_list(0, CMDFLAG_TEST);
return;
}
rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
if( rc==1 ){
fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
command_list(0, 0xff);
fossil_exit(1);
}else if( rc==2 ){
fossil_print("ambiguous command prefix: %s\nMatching commands:\n",
g.argv[2]);
command_list(g.argv[2], 0xff);
fossil_exit(1);
}
z = aCmdHelp[idx];
if( z==0 ){
fossil_fatal("no help available for the %s command",
aCommand[idx].zName);
}
while( *z ){
if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
fossil_print("%s", g.argv[0]);
|
>
>
>
>
>
|
|
|
|
|
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
|
** Display information on how to use COMMAND. To display a list of
** available commands one of:
**
** %fossil help Show common commands
** %fossil help --all Show both common and auxiliary commands
** %fossil help --test Show test commands only
** %fossil help --aux Show auxiliary commands only
** %fossil help --www Show list of WWW pages
*/
void help_cmd(void){
int rc, idx;
const char *z;
if( g.argc<3 ){
z = g.argv[0];
fossil_print(
"Usage: %s help COMMAND\n"
"Common COMMANDs: (use \"%s help --all\" for a complete list)\n",
z, z);
command_list(0, CMDFLAG_1ST_TIER);
version_cmd();
return;
}
if( find_option("all",0,0) ){
command_list(0, CMDFLAG_1ST_TIER | CMDFLAG_2ND_TIER);
return;
}
else if( find_option("www",0,0) ){
command_list(0, CMDFLAG_WEBPAGE);
return;
}
else if( find_option("aux",0,0) ){
command_list(0, CMDFLAG_2ND_TIER);
return;
}
else if( find_option("test",0,0) ){
command_list(0, CMDFLAG_TEST);
return;
}
rc = name_search(g.argv[2], aCommand, count(aCommand), &idx);
if( rc==1 ){
fossil_print("unknown command: %s\nAvailable commands:\n", g.argv[2]);
command_list(0, 0xff & ~CMDFLAG_WEBPAGE);
fossil_exit(1);
}else if( rc==2 ){
fossil_print("ambiguous command prefix: %s\nMatching commands:\n",
g.argv[2]);
command_list(g.argv[2], 0xff);
fossil_exit(1);
}
z = aCmdHelp[idx].zText;
if( z==0 ){
fossil_fatal("no help available for the %s command",
aCommand[idx].zName);
}
while( *z ){
if( *z=='%' && strncmp(z, "%fossil", 7)==0 ){
fossil_print("%s", g.argv[0]);
|
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
|
@ <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++;
|
|
|
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
|
@ <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].zText;
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++;
|
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
|
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
|
|
|
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
|
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].zText)
@ </pre></blockquote>
}
style_footer();
}
/*
** Set the g.zBaseURL value to the full URL for the toplevel of
|