Skip to content
Snippets Groups Projects
Commit b67a5a26 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Don't include both normal and extended file descriptions by default

As pointed out by DesotoFireflite (VALHALLA), both the file's
short/normal description and the extended description were being
included in all file listings. This is probably want most sysops
will want since the extended description is often used as the content
of the short/normal description, resulting in repeated content. So,
by default, if there is an extended file description, don't output
the short/normal file description.

If you want to include *both* the short and extended descriptions
(for files that have both), include both the -ext and -desc command
line options.
parent 8b93237c
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -33,6 +33,7 @@ var detail = -1;
var dir_list = [];
var filespec = "";
var extdesc_prefix;
var both_desc = false;
var since = 0;
var props = [];
var fmt;
......@@ -140,11 +141,16 @@ for(var i = 0; i < argc; i++) {
continue;
}
if(opt == "ext") {
if(detail == FileBase.DETAIL.NORM)
both_desc = true;
detail = FileBase.DETAIL.EXTENDED;
continue;
}
if(opt == "desc") {
detail = FileBase.DETAIL.NORM;
if(detail >= FileBase.DETAIL.EXTENDED)
both_desc = true;
else
detail = FileBase.DETAIL.NORM;
continue;
}
if(opt.indexOf("p=") == 0) {
......@@ -218,7 +224,8 @@ if(fmt != "json") {
props.push("extdesc");
if(extdesc_prefix === undefined)
extdesc_prefix = format("%*s| ", offset - 1, "");
f += "%s";
if(both_desc)
f += "%s";
}
if(!fmt)
fmt = f;
......@@ -385,9 +392,13 @@ function list_file(file, fmt, props)
case "string":
if(name == 'name')
a.push(FileBase().format_name(p, name_len, options.pad));
else if(name == 'extdesc')
a.push(p.replace(/([^\n]+)/g, (extdesc_prefix + "$&")).trimRight());
else
else if(name == 'extdesc') {
if(both_desc)
a.push(p.replace(/([^\n]+)/g, (extdesc_prefix + "$&")).trimRight());
else
a.push(p.trim().replace(/\n/g, '\n' + extdesc_prefix).trimRight());
}
else if(both_desc || name !== 'desc' || !file.extdesc)
a.push(p);
break;
case "number":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment