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

Merge branch 'dd_file_lister_loadable_module_desc_search_and_ctrl_c_help_screen' into 'master'

DDFileLister: Description search as loadable module now works. Added mention of Ctrl-C to the help screen.

See merge request !422
parents f1ff4043 1362c3ff
No related branches found
No related tags found
1 merge request!422DDFileLister: Description search as loadable module now works. Added mention of Ctrl-C to the help screen.
...@@ -106,6 +106,9 @@ ...@@ -106,6 +106,9 @@
* Fix for possibly no file description when adding to the batch DL queue. * Fix for possibly no file description when adding to the batch DL queue.
* Also, fix for file description screen refresh (off by one column) for extended * Also, fix for file description screen refresh (off by one column) for extended
* descriptions * descriptions
* 2024-03-08 Eric Oulashin Version 2.18
* Bug fix: Got description search working when used as a loadable module.
* Added Ctrl-C to the help screen to mention it can be used to abort.
*/ */
"use strict"; "use strict";
...@@ -150,8 +153,8 @@ require("attr_conv.js", "convertAttrsToSyncPerSysCfg"); ...@@ -150,8 +153,8 @@ require("attr_conv.js", "convertAttrsToSyncPerSysCfg");
// Lister version information // Lister version information
var LISTER_VERSION = "2.17"; var LISTER_VERSION = "2.18";
var LISTER_DATE = "2024-02-28"; var LISTER_DATE = "2024-03-08";
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
...@@ -292,6 +295,9 @@ var gTraditionalUseSyncStock = false; ...@@ -292,6 +295,9 @@ var gTraditionalUseSyncStock = false;
// The filename pattern to match // The filename pattern to match
var gFilespec = "*"; var gFilespec = "*";
// Description keyword to match (empty for no keyword search)
var gDescKeyword = "";
// The sort order to use for the file list // The sort order to use for the file list
var gFileSortOrder = SORT_PER_DIR_CFG; // Use the file directory's configured sort order option var gFileSortOrder = SORT_PER_DIR_CFG; // Use the file directory's configured sort order option
...@@ -1768,6 +1774,9 @@ function displayHelpScreen() ...@@ -1768,6 +1774,9 @@ function displayHelpScreen()
printf(printfStr, "DEL", "Delete the file(s)"); printf(printfStr, "DEL", "Delete the file(s)");
} }
printf(printfStr, "?", "Show this help screen"); printf(printfStr, "?", "Show this help screen");
// Ctrl-C for aborting (wanted to use isDoingFileSearch() but it seems even for searching/scanning,
// the mode is LIST_DIR rather than a search/scan
printf(printfStr, "Ctrl-C", "Abort (can quit out of searching, etc.)");
printf(printfStr, "Q", "Quit back to the BBS"); printf(printfStr, "Q", "Quit back to the BBS");
console.attributes = "N"; console.attributes = "N";
console.crlf(); console.crlf();
...@@ -4069,7 +4078,7 @@ function parseArgs(argv) ...@@ -4069,7 +4078,7 @@ function parseArgs(argv)
else else
gListBehavior = FLBehavior; gListBehavior = FLBehavior;
// If the 'no header' option was passed, then disable that // If the 'no header' option was passed, then disable that
if ((gListBehavior & FL_NO_HDR) == FL_NO_HDR) if (Boolean(gListBehavior & FL_NO_HDR))
gListBehavior &= ~FL_NO_HDR; gListBehavior &= ~FL_NO_HDR;
scriptRanAsLoadableModule = true; scriptRanAsLoadableModule = true;
...@@ -4085,11 +4094,11 @@ function parseArgs(argv) ...@@ -4085,11 +4094,11 @@ function parseArgs(argv)
// - 0: Bool (scanning all directories): 0/1 // - 0: Bool (scanning all directories): 0/1
// - 1: FL_ mode value // - 1: FL_ mode value
gScanAllDirs = (argv[0] == "1"); gScanAllDirs = (argv[0] == "1");
if ((FLBehavior & FL_ULTIME) == FL_ULTIME) if (Boolean(FLBehavior & FL_ULTIME))
gScriptMode = MODE_NEW_FILE_SEARCH; gScriptMode = MODE_NEW_FILE_SEARCH;
else if ((FLBehavior & FL_FINDDESC) == FL_FINDDESC || (FLBehavior & FL_EXFIND) == FL_EXFIND) else if (Boolean(FLBehavior & FL_FINDDESC) || Boolean(FLBehavior & FL_EXFIND))
gScriptMode = MODE_SEARCH_DESCRIPTION; gScriptMode = MODE_SEARCH_DESCRIPTION;
if ((FLBehavior & FL_VIEW) == FL_VIEW) if (Boolean(FLBehavior & FL_VIEW))
{ {
// View ZIP/ARC/GIF etc. info // View ZIP/ARC/GIF etc. info
// TODO: Not sure what to do with this // TODO: Not sure what to do with this
...@@ -4103,17 +4112,39 @@ function parseArgs(argv) ...@@ -4103,17 +4112,39 @@ function parseArgs(argv)
// - 1: Bool (scanning all directories): 0/1 // - 1: Bool (scanning all directories): 0/1
} }
} }
// 3 args - Listing // 3 args - Internal code, mode, filespec/description keyword
else if (argv.length >= 3) //==3 else if (argv.length >= 3) //==3
{ {
//if (user.is_sysop) console.print("\x01nargv:" + argv + ":\r\n\x01p"); // Temporary
// - 0: Directory internal code // - 0: Directory internal code
// - 1: FL_ mode value // - 1: FL_ mode value
// - 2: Filespec (i.e., *, *.zip, etc.) // - 2: Filespec (i.e., *, *.zip, etc.) or keyword for description search
// Filename search: os2xferp,4,*.zip:
if (!file_area.dir.hasOwnProperty(argv[0])) if (!file_area.dir.hasOwnProperty(argv[0]))
return false; return false;
gDirCode = argv[0]; gDirCode = argv[0];
if (Boolean(FLBehavior & FL_FINDDESC) || Boolean(FLBehavior & FL_EXFIND))
{
gScriptMode = MODE_SEARCH_DESCRIPTION;
// The keyword could have spaces in it, so look at argv[2] and the remainder of the
// command-line arguments and combine those into gDescKeyword
gDescKeyword = "";
for (var i = 2; i < argv.length; ++i)
{
if (argv[i].length > 0)
{
if (gDescKeyword.length > 0)
gDescKeyword += " ";
gDescKeyword += argv[i];
}
}
}
else if (Boolean(FLBehavior & FL_NO_HDR))
{
// Filename search
gFilespec = argv[2]; gFilespec = argv[2];
if ((FLBehavior & FL_VIEW) == FL_VIEW) }
else if (Boolean(FLBehavior & FL_VIEW))
{ {
// View ZIP/ARC/GIF etc. info // View ZIP/ARC/GIF etc. info
// TODO: Not sure what to do with this // TODO: Not sure what to do with this
...@@ -4121,9 +4152,9 @@ function parseArgs(argv) ...@@ -4121,9 +4152,9 @@ function parseArgs(argv)
} }
// Options that apply to both searching and listing // Options that apply to both searching and listing
if ((FLBehavior & FL_ULTIME) == FL_ULTIME) if (Boolean(FLBehavior & FL_ULTIME))
gFileSortOrder = SORT_FL_ULTIME; gFileSortOrder = SORT_FL_ULTIME;
else if ((FLBehavior & FL_DLTIME) == FL_DLTIME) else if (Boolean(FLBehavior & FL_DLTIME))
gFileSortOrder = SORT_FL_DLTIME; gFileSortOrder = SORT_FL_DLTIME;
} }
...@@ -4248,7 +4279,10 @@ function populateFileList(pSearchMode) ...@@ -4248,7 +4279,10 @@ function populateFileList(pSearchMode)
{ {
var lastDirCode = ""; var lastDirCode = "";
// If not saerching all already, prompt the user for directory, library, or all // If gDescKeyword hasn't been specified (i.e., via use as a loadable module), then if
// not saerching all already, prompt the user for directory, library, or all
if (gDescKeyword == "")
{
var validInputOptions = "DLA"; var validInputOptions = "DLA";
var userInputDLA = ""; var userInputDLA = "";
if (gScanAllDirs) if (gScanAllDirs)
...@@ -4284,6 +4318,17 @@ function populateFileList(pSearchMode) ...@@ -4284,6 +4318,17 @@ function populateFileList(pSearchMode)
for (var i = 0; i < searchRetObj.errors.length; ++i) for (var i = 0; i < searchRetObj.errors.length; ++i)
dirErrors.push(searchRetObj.errors[i]); dirErrors.push(searchRetObj.errors[i]);
} }
else
{
if (gDirCode.length > 0 && gDescKeyword.length > 0)
{
var searchRetObj = searchDirWithDescUpper(gDirCode, gDescKeyword.toUpperCase());
//searchRetObj.foundFiles
for (var i = 0; i < searchRetObj.dirErrors.length; ++i)
dirErrors.push(searchRetObj.dirErrors[i]);
}
}
}
else if (pSearchMode == MODE_NEW_FILE_SEARCH) else if (pSearchMode == MODE_NEW_FILE_SEARCH)
{ {
// New file search // New file search
......
Digital Distortion File Lister Digital Distortion File Lister
Version 2.17 Version 2.18
Release date: 2024-02-28 Release date: 2024-03-08
by by
......
...@@ -5,6 +5,10 @@ Revision History (change log) ...@@ -5,6 +5,10 @@ Revision History (change log)
============================= =============================
Version Date Description Version Date Description
------- ---- ----------- ------- ---- -----------
2.18 2024-03-08 Bug fix: Got description search working when used as a
loadable module.
Added Ctrl-C to the help screen to mention it can be used
to abort.
2.17 2024-02-28 Fix for possibly no file description when adding to the 2.17 2024-02-28 Fix for possibly no file description when adding to the
batch DL queue. batch DL queue.
Also, fix for file description screen refresh (off by one Also, fix for file description screen refresh (off by one
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment