Fossil SCM

modified help-no-tty to not change based on destination, but to provide a help --full option to displayall the text at once for those who would like to pipe it through grep / less / capture to a file

scott 2021-02-02 20:22 help-full
Commit 93fd6d3395a31c7d156381336acbd862c6a38bce0d503b10a16033817e7cc881
1 file changed +25 -23
+25 -23
--- src/dispatch.c
+++ src/dispatch.c
@@ -1025,10 +1025,11 @@
10251025
** -o|--options List command-line options common to all commands
10261026
** -s|--setting List setting names
10271027
** -t|--test List unsupported "test" commands
10281028
** -x|--aux List only auxiliary commands
10291029
** -w|--www List all web pages
1030
+** -f|--full List full help text
10301031
**
10311032
** These options can be used when TOPIC is present:
10321033
**
10331034
** -h|--html Format output as HTML rather than plain text
10341035
** -c|--commands Restrict TOPIC search to commands
@@ -1041,33 +1042,18 @@
10411042
const char *zCmdOrPage;
10421043
const CmdOrPage *pCmd = 0;
10431044
int useHtml = 0;
10441045
Blob txt;
10451046
if( g.argc<3 ){
1046
- if( isatty(1) ){
1047
- z = g.argv[0];
1048
- fossil_print(
1049
- "Usage: %s help TOPIC\n"
1050
- "Try \"%s help help\" or \"%s help -a\" for more options\n"
1051
- "Frequently used commands:\n",
1052
- z, z, z);
1053
- command_list(0, CMDFLAG_1ST_TIER);
1054
- version_cmd();
1055
- }
1056
- else {
1057
- fossil_print("fossil commands:\n\n");
1058
- command_list(0, CMDFLAG_1ST_TIER);
1059
- fossil_print("\nfossil auxiliary commands:\n\n");
1060
- command_list(0, CMDFLAG_2ND_TIER);
1061
- fossil_print("\n%s", zOptions);
1062
- fossil_print("\nfossil settings:\n\n");
1063
- command_list(0, CMDFLAG_SETTING);
1064
- fossil_print("\nfossil web pages:\n\n");
1065
- command_list(0, CMDFLAG_WEBPAGE);
1066
- fossil_print("\n");
1067
- version_cmd();
1068
- }
1047
+ z = g.argv[0];
1048
+ fossil_print(
1049
+ "Usage: %s help TOPIC\n"
1050
+ "Try \"%s help help\" or \"%s help -a\" for more options\n"
1051
+ "Frequently used commands:\n",
1052
+ z, z, z);
1053
+ command_list(0, CMDFLAG_1ST_TIER);
1054
+ version_cmd();
10691055
return;
10701056
}
10711057
if( find_option("options","o",0) ){
10721058
fossil_print("%s", zOptions);
10731059
return;
@@ -1089,10 +1075,26 @@
10891075
return;
10901076
}
10911077
else if( find_option("setting","s",0) ){
10921078
command_list(0, CMDFLAG_SETTING);
10931079
return;
1080
+ }
1081
+ else if( find_option("full","f",0) ){
1082
+ fossil_print("fossil commands:\n\n");
1083
+ command_list(0, CMDFLAG_1ST_TIER);
1084
+ fossil_print("\nfossil auxiliary commands:\n\n");
1085
+ command_list(0, CMDFLAG_2ND_TIER);
1086
+ fossil_print("\n%s", zOptions);
1087
+ fossil_print("\nfossil settings:\n\n");
1088
+ command_list(0, CMDFLAG_SETTING);
1089
+ fossil_print("\nfossil web pages:\n\n");
1090
+ command_list(0, CMDFLAG_WEBPAGE);
1091
+ fossil_print("\nfossil test commands (unsupported):\n\n");
1092
+ command_list(0, CMDFLAG_TEST);
1093
+ fossil_print("\n");
1094
+ version_cmd();
1095
+ return;
10941096
}
10951097
useHtml = find_option("html","h",0)!=0;
10961098
isPage = ('/' == *g.argv[2]) ? 1 : 0;
10971099
if(isPage){
10981100
zCmdOrPage = "page";
10991101
--- src/dispatch.c
+++ src/dispatch.c
@@ -1025,10 +1025,11 @@
1025 ** -o|--options List command-line options common to all commands
1026 ** -s|--setting List setting names
1027 ** -t|--test List unsupported "test" commands
1028 ** -x|--aux List only auxiliary commands
1029 ** -w|--www List all web pages
 
1030 **
1031 ** These options can be used when TOPIC is present:
1032 **
1033 ** -h|--html Format output as HTML rather than plain text
1034 ** -c|--commands Restrict TOPIC search to commands
@@ -1041,33 +1042,18 @@
1041 const char *zCmdOrPage;
1042 const CmdOrPage *pCmd = 0;
1043 int useHtml = 0;
1044 Blob txt;
1045 if( g.argc<3 ){
1046 if( isatty(1) ){
1047 z = g.argv[0];
1048 fossil_print(
1049 "Usage: %s help TOPIC\n"
1050 "Try \"%s help help\" or \"%s help -a\" for more options\n"
1051 "Frequently used commands:\n",
1052 z, z, z);
1053 command_list(0, CMDFLAG_1ST_TIER);
1054 version_cmd();
1055 }
1056 else {
1057 fossil_print("fossil commands:\n\n");
1058 command_list(0, CMDFLAG_1ST_TIER);
1059 fossil_print("\nfossil auxiliary commands:\n\n");
1060 command_list(0, CMDFLAG_2ND_TIER);
1061 fossil_print("\n%s", zOptions);
1062 fossil_print("\nfossil settings:\n\n");
1063 command_list(0, CMDFLAG_SETTING);
1064 fossil_print("\nfossil web pages:\n\n");
1065 command_list(0, CMDFLAG_WEBPAGE);
1066 fossil_print("\n");
1067 version_cmd();
1068 }
1069 return;
1070 }
1071 if( find_option("options","o",0) ){
1072 fossil_print("%s", zOptions);
1073 return;
@@ -1089,10 +1075,26 @@
1089 return;
1090 }
1091 else if( find_option("setting","s",0) ){
1092 command_list(0, CMDFLAG_SETTING);
1093 return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1094 }
1095 useHtml = find_option("html","h",0)!=0;
1096 isPage = ('/' == *g.argv[2]) ? 1 : 0;
1097 if(isPage){
1098 zCmdOrPage = "page";
1099
--- src/dispatch.c
+++ src/dispatch.c
@@ -1025,10 +1025,11 @@
1025 ** -o|--options List command-line options common to all commands
1026 ** -s|--setting List setting names
1027 ** -t|--test List unsupported "test" commands
1028 ** -x|--aux List only auxiliary commands
1029 ** -w|--www List all web pages
1030 ** -f|--full List full help text
1031 **
1032 ** These options can be used when TOPIC is present:
1033 **
1034 ** -h|--html Format output as HTML rather than plain text
1035 ** -c|--commands Restrict TOPIC search to commands
@@ -1041,33 +1042,18 @@
1042 const char *zCmdOrPage;
1043 const CmdOrPage *pCmd = 0;
1044 int useHtml = 0;
1045 Blob txt;
1046 if( g.argc<3 ){
1047 z = g.argv[0];
1048 fossil_print(
1049 "Usage: %s help TOPIC\n"
1050 "Try \"%s help help\" or \"%s help -a\" for more options\n"
1051 "Frequently used commands:\n",
1052 z, z, z);
1053 command_list(0, CMDFLAG_1ST_TIER);
1054 version_cmd();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1055 return;
1056 }
1057 if( find_option("options","o",0) ){
1058 fossil_print("%s", zOptions);
1059 return;
@@ -1089,10 +1075,26 @@
1075 return;
1076 }
1077 else if( find_option("setting","s",0) ){
1078 command_list(0, CMDFLAG_SETTING);
1079 return;
1080 }
1081 else if( find_option("full","f",0) ){
1082 fossil_print("fossil commands:\n\n");
1083 command_list(0, CMDFLAG_1ST_TIER);
1084 fossil_print("\nfossil auxiliary commands:\n\n");
1085 command_list(0, CMDFLAG_2ND_TIER);
1086 fossil_print("\n%s", zOptions);
1087 fossil_print("\nfossil settings:\n\n");
1088 command_list(0, CMDFLAG_SETTING);
1089 fossil_print("\nfossil web pages:\n\n");
1090 command_list(0, CMDFLAG_WEBPAGE);
1091 fossil_print("\nfossil test commands (unsupported):\n\n");
1092 command_list(0, CMDFLAG_TEST);
1093 fossil_print("\n");
1094 version_cmd();
1095 return;
1096 }
1097 useHtml = find_option("html","h",0)!=0;
1098 isPage = ('/' == *g.argv[2]) ? 1 : 0;
1099 if(isPage){
1100 zCmdOrPage = "page";
1101

Keyboard Shortcuts

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