@@ -1099,9 +1099,30 @@ InstallGlobalFunction( IsPackageMarkedForLoading, function( name, version )
1099
1099
# #
1100
1100
# F DefaultPackageBannerString( <inforec> )
1101
1101
# #
1102
- InstallGlobalFunction( DefaultPackageBannerString, function ( inforec )
1102
+
1103
+ DeclareUserPreference( rec (
1104
+ name:= " ShortBanners" ,
1105
+ description:= [
1106
+ " If this option is set to <K>true</K>, package banners printed during \
1107
+ loading will only show the name, version and description of a package."
1108
+ ] ,
1109
+ default:= false ,
1110
+ values:= [ true , false ] ,
1111
+ multi:= false ,
1112
+ ) );
1113
+
1114
+ InstallGlobalFunction( DefaultPackageBannerString,
1115
+ function ( inforec, useShortBanner... )
1103
1116
local len, sep, i, str, authors, maintainers, contributors, printPersons;
1104
1117
1118
+ if Length( useShortBanner ) = 0 then
1119
+ useShortBanner := false ;
1120
+ elif Length( useShortBanner ) = 1 then
1121
+ useShortBanner := useShortBanner[ 1 ] ;
1122
+ else
1123
+ Error( " DefaultPackageBannerString must be called with at most two arguments" );
1124
+ fi ;
1125
+
1105
1126
# Start with a row of `-' signs.
1106
1127
len:= SizeScreen()[ 1 ] - 3 ;
1107
1128
if GAPInfo.TermEncoding = " UTF-8" then
@@ -1136,69 +1157,73 @@ InstallGlobalFunction( DefaultPackageBannerString, function( inforec )
1136
1157
fi ;
1137
1158
Add( str, ' \n ' );
1138
1159
1139
- # Add info about the authors and/or maintainers
1140
- printPersons := function ( role, persons )
1141
- local fill, person;
1142
- fill:= ListWithIdenticalEntries( Length(role), ' ' );
1143
- Append( str, role );
1144
- for i in [ 1 .. Length( persons ) ] do
1145
- person:= persons[ i] ;
1146
- Append( str, person.FirstNames );
1147
- Append( str, " " );
1148
- Append( str, person.LastName );
1149
- if IsBound ( person.WWWHome ) then
1150
- Append( str, Concatenation( " (" , person.WWWHome, " )" ) );
1151
- elif IsBound ( person.Email ) then
1152
- Append( str, Concatenation( " (" , person.Email, " )" ) );
1153
- fi ;
1154
- if i = Length( persons ) then
1155
- Append( str, " .\n " );
1156
- elif i = Length( persons )- 1 then
1157
- if i = 1 then
1158
- Append( str, " and\n " );
1159
- else
1160
- Append( str, " , and\n " );
1160
+ if not useShortBanner then
1161
+ # Add info about the authors and/or maintainers
1162
+ printPersons := function ( role, persons )
1163
+ local fill, person;
1164
+ fill:= ListWithIdenticalEntries( Length(role), ' ' );
1165
+ Append( str, role );
1166
+ for i in [ 1 .. Length( persons ) ] do
1167
+ person:= persons[ i] ;
1168
+ Append( str, person.FirstNames );
1169
+ Append( str, " " );
1170
+ Append( str, person.LastName );
1171
+ if IsBound ( person.WWWHome ) then
1172
+ Append( str, Concatenation( " (" , person.WWWHome, " )" ) );
1173
+ elif IsBound ( person.Email ) then
1174
+ Append( str, Concatenation( " (" , person.Email, " )" ) );
1175
+ fi ;
1176
+ if i = Length( persons ) then
1177
+ Append( str, " .\n " );
1178
+ elif i = Length( persons )- 1 then
1179
+ if i = 1 then
1180
+ Append( str, " and\n " );
1181
+ else
1182
+ Append( str, " , and\n " );
1183
+ fi ;
1184
+ Append( str, fill );
1185
+ else
1186
+ Append( str, " ,\n " );
1187
+ Append( str, fill );
1188
+ fi ;
1189
+ od ;
1190
+ end ;
1191
+ if IsBound ( inforec.Persons ) then
1192
+ authors:= Filtered( inforec.Persons, x -> x.IsAuthor );
1193
+ if not IsEmpty( authors ) then
1194
+ printPersons( " by " , authors );
1195
+ fi ;
1196
+ contributors:= Filtered( inforec.Persons, x -> not x.IsAuthor and not x.IsMaintainer );
1197
+ if not IsEmpty( contributors ) then
1198
+ Append( str, " with contributions by:\n " );
1199
+ printPersons( " " , contributors );
1200
+ fi ;
1201
+ maintainers:= Filtered( inforec.Persons, x -> x.IsMaintainer );
1202
+ if not IsEmpty( maintainers ) and authors <> maintainers then
1203
+ Append( str, " maintained by:\n " );
1204
+ printPersons( " " , maintainers );
1161
1205
fi ;
1162
- Append( str, fill );
1163
- else
1164
- Append( str, " ,\n " );
1165
- Append( str, fill );
1166
1206
fi ;
1167
- od ;
1168
- end ;
1169
- if IsBound ( inforec.Persons ) then
1170
- authors:= Filtered( inforec.Persons, x -> x.IsAuthor );
1171
- if not IsEmpty( authors ) then
1172
- printPersons( " by " , authors );
1173
- fi ;
1174
- contributors:= Filtered( inforec.Persons, x -> not x.IsAuthor and not x.IsMaintainer );
1175
- if not IsEmpty( contributors ) then
1176
- Append( str, " with contributions by:\n " );
1177
- printPersons( " " , contributors );
1178
- fi ;
1179
- maintainers:= Filtered( inforec.Persons, x -> x.IsMaintainer );
1180
- if not IsEmpty( maintainers ) and authors <> maintainers then
1181
- Append( str, " maintained by:\n " );
1182
- printPersons( " " , maintainers );
1183
- fi ;
1184
- fi ;
1185
1207
1186
- # Add info about the home page of the package.
1187
- if IsBound ( inforec.PackageWWWHome ) then
1188
- Append( str, " Homepage: " );
1189
- Append( str, inforec.PackageWWWHome );
1190
- Append( str, " \n " );
1191
- fi ;
1208
+ # Add info about the home page of the package.
1209
+ if IsBound ( inforec.PackageWWWHome ) then
1210
+ Append( str, " Homepage: " );
1211
+ Append( str, inforec.PackageWWWHome );
1212
+ Append( str, " \n " );
1213
+ fi ;
1214
+
1215
+ # Add info about the issue tracker of the package.
1216
+ if IsBound ( inforec.IssueTrackerURL ) then
1217
+ Append( str, " Report issues at " );
1218
+ Append( str, inforec.IssueTrackerURL );
1219
+ Append( str, " \n " );
1220
+ fi ;
1192
1221
1193
- # Add info about the issue tracker of the package.
1194
- if IsBound ( inforec.IssueTrackerURL ) then
1195
- Append( str, " Report issues at " );
1196
- Append( str, inforec.IssueTrackerURL );
1197
- Append( str, " \n " );
1222
+ str := Concatenation(sep, str, sep);
1198
1223
fi ;
1199
1224
1200
1225
# temporary hack, in some package names with umlauts are in HTML encoding
1201
- str := Concatenation(sep, RecodeForCurrentTerminal(str), sep );
1226
+ str := RecodeForCurrentTerminal(str);
1202
1227
str:= ReplacedString( str, " ä" , RecodeForCurrentTerminal(" ä" ) );
1203
1228
str:= ReplacedString( str, " ö" , RecodeForCurrentTerminal(" ö" ) );
1204
1229
str:= ReplacedString( str, " ü" , RecodeForCurrentTerminal(" ü" ) );
@@ -1424,7 +1449,9 @@ BindGlobal( "LoadPackage_ReadImplementationParts",
1424
1449
1425
1450
# If the component `BannerString' is bound in `info' then we print
1426
1451
# this string, otherwise we print the default banner string.
1427
- if IsBound ( info.BannerFunction ) then
1452
+ if UserPreference( " ShortBanners" ) then
1453
+ bannerstring:= DefaultPackageBannerString( info, true );
1454
+ elif IsBound ( info.BannerFunction ) then
1428
1455
bannerstring:= RecodeForCurrentTerminal(info.BannerFunction(info));
1429
1456
elif IsBound ( info.BannerString ) then
1430
1457
bannerstring:= RecodeForCurrentTerminal(info.BannerString);
0 commit comments