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
Commit
93fd6d3395a31c7d156381336acbd862c6a38bce0d503b10a16033817e7cc881
Parent
d7929436815ce79…
1 file changed
+25
-23
+25
-23
| --- src/dispatch.c | ||
| +++ src/dispatch.c | ||
| @@ -1025,10 +1025,11 @@ | ||
| 1025 | 1025 | ** -o|--options List command-line options common to all commands |
| 1026 | 1026 | ** -s|--setting List setting names |
| 1027 | 1027 | ** -t|--test List unsupported "test" commands |
| 1028 | 1028 | ** -x|--aux List only auxiliary commands |
| 1029 | 1029 | ** -w|--www List all web pages |
| 1030 | +** -f|--full List full help text | |
| 1030 | 1031 | ** |
| 1031 | 1032 | ** These options can be used when TOPIC is present: |
| 1032 | 1033 | ** |
| 1033 | 1034 | ** -h|--html Format output as HTML rather than plain text |
| 1034 | 1035 | ** -c|--commands Restrict TOPIC search to commands |
| @@ -1041,33 +1042,18 @@ | ||
| 1041 | 1042 | const char *zCmdOrPage; |
| 1042 | 1043 | const CmdOrPage *pCmd = 0; |
| 1043 | 1044 | int useHtml = 0; |
| 1044 | 1045 | Blob txt; |
| 1045 | 1046 | 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(); | |
| 1069 | 1055 | return; |
| 1070 | 1056 | } |
| 1071 | 1057 | if( find_option("options","o",0) ){ |
| 1072 | 1058 | fossil_print("%s", zOptions); |
| 1073 | 1059 | return; |
| @@ -1089,10 +1075,26 @@ | ||
| 1089 | 1075 | return; |
| 1090 | 1076 | } |
| 1091 | 1077 | else if( find_option("setting","s",0) ){ |
| 1092 | 1078 | command_list(0, CMDFLAG_SETTING); |
| 1093 | 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; | |
| 1094 | 1096 | } |
| 1095 | 1097 | useHtml = find_option("html","h",0)!=0; |
| 1096 | 1098 | isPage = ('/' == *g.argv[2]) ? 1 : 0; |
| 1097 | 1099 | if(isPage){ |
| 1098 | 1100 | zCmdOrPage = "page"; |
| 1099 | 1101 |
| --- 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 |