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

Add support for an optional description character offset (number) arg

If all descriptions start a fixed offset and the default parsing
logic (regex) isn't working for the sysop, they can specify the exact
error offset to use for the beginning of each file's description. This
offset is only used for the initial line of the description, not the
continuation lines, but perhaps that could be done if needed.

This is an attempt to address issue #530

I first attempted to use "Lookbehind Assertions" in the regex, but
didn't have any success and decided the brute force method that the
old addfiles utility used might be as simpler solution and provide an
effective work-around for more potential issues with auto-detecting
the beginning of the useful file description.

I also added descriptions of the optional arguments to the help output.
parent c02f2513
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -35,6 +35,7 @@ function archive_date(file)
var uploader;
var listfile;
var date_fmt;
var desc_off = 0;
var options = {};
var exclude = [];
var include = "*";
......@@ -47,7 +48,7 @@ for(var i = 0; i < argc; i++) {
while(opt[0] == '-')
opt = opt.slice(1);
if(opt == '?' || opt.toLowerCase() == "help") {
writeln("usage: [-options] [dir-code] [listfile]");
writeln("usage: [-options] [dir-code] [listfile] [desc-off]");
writeln("options:");
writeln(" -all add files in all libraries/directories (implies -auto)");
writeln(" -lib=<name> add files in all directories of specified library (implies -auto)");
......@@ -65,6 +66,10 @@ for(var i = 0; i < argc; i++) {
writeln(" -delete delete list after import");
writeln(" -v increase verbosity of output");
writeln(" -debug enable debug output");
writeln("optional:");
writeln(" dir-code: File directory internal code");
writeln(" listfile: Name of listfile (e.g. FILES.BBS)");
writeln(" desc-off: Descripition character offset (number)");
exit(0);
}
if(opt.indexOf("ex=") == 0) {
......@@ -119,7 +124,9 @@ for(var i = 0; i < argc; i++) {
}
options[opt] = true;
} else {
if(!dir_list.length)
if(Number(arg))
desc_off = Number(arg);
else if(!dir_list.length)
dir_list.push(arg);
else
listfile = arg;
......@@ -280,6 +287,8 @@ function parse_file_list(lines)
// writeln('fname line match: ' + JSON.stringify(match));
if(match && match.length > 1) {
var file = { name: match[1], desc: match[2] };
if(desc_off)
file.desc = line.substring(desc_off).trim();
if(file.desc && file.desc.length > LEN_FDESC)
file.extdesc = word_wrap(file.desc, 45);
file_list.push(file);
......
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