Fossil SCM
modified help command to output detailed help information when stdout is not a tty
Commit
d7929436815ce79285779c5b77525968920762cfc122edeb75f72b56e28b3e2f
Parent
bfa99a93995ed02…
1 file changed
+23
-8
+23
-8
| --- src/dispatch.c | ||
| +++ src/dispatch.c | ||
| @@ -1041,18 +1041,33 @@ | ||
| 1041 | 1041 | const char *zCmdOrPage; |
| 1042 | 1042 | const CmdOrPage *pCmd = 0; |
| 1043 | 1043 | int useHtml = 0; |
| 1044 | 1044 | Blob txt; |
| 1045 | 1045 | if( g.argc<3 ){ |
| 1046 | - z = g.argv[0]; | |
| 1047 | - fossil_print( | |
| 1048 | - "Usage: %s help TOPIC\n" | |
| 1049 | - "Try \"%s help help\" or \"%s help -a\" for more options\n" | |
| 1050 | - "Frequently used commands:\n", | |
| 1051 | - z, z, z); | |
| 1052 | - command_list(0, CMDFLAG_1ST_TIER); | |
| 1053 | - version_cmd(); | |
| 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 | + } | |
| 1054 | 1069 | return; |
| 1055 | 1070 | } |
| 1056 | 1071 | if( find_option("options","o",0) ){ |
| 1057 | 1072 | fossil_print("%s", zOptions); |
| 1058 | 1073 | return; |
| 1059 | 1074 |
| --- src/dispatch.c | |
| +++ src/dispatch.c | |
| @@ -1041,18 +1041,33 @@ | |
| 1041 | const char *zCmdOrPage; |
| 1042 | const CmdOrPage *pCmd = 0; |
| 1043 | int useHtml = 0; |
| 1044 | Blob txt; |
| 1045 | if( g.argc<3 ){ |
| 1046 | z = g.argv[0]; |
| 1047 | fossil_print( |
| 1048 | "Usage: %s help TOPIC\n" |
| 1049 | "Try \"%s help help\" or \"%s help -a\" for more options\n" |
| 1050 | "Frequently used commands:\n", |
| 1051 | z, z, z); |
| 1052 | command_list(0, CMDFLAG_1ST_TIER); |
| 1053 | version_cmd(); |
| 1054 | return; |
| 1055 | } |
| 1056 | if( find_option("options","o",0) ){ |
| 1057 | fossil_print("%s", zOptions); |
| 1058 | return; |
| 1059 |
| --- src/dispatch.c | |
| +++ src/dispatch.c | |
| @@ -1041,18 +1041,33 @@ | |
| 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; |
| 1074 |