Fossil SCM

modified help command to output detailed help information when stdout is not a tty

scott 2021-02-02 16:01 trunk
Commit d7929436815ce79285779c5b77525968920762cfc122edeb75f72b56e28b3e2f
1 file changed +23 -8
+23 -8
--- src/dispatch.c
+++ src/dispatch.c
@@ -1041,18 +1041,33 @@
10411041
const char *zCmdOrPage;
10421042
const CmdOrPage *pCmd = 0;
10431043
int useHtml = 0;
10441044
Blob txt;
10451045
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
+ }
10541069
return;
10551070
}
10561071
if( find_option("options","o",0) ){
10571072
fossil_print("%s", zOptions);
10581073
return;
10591074
--- 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

Keyboard Shortcuts

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