Skip to content

sdk: Make wildcard support for listing USS files optional #182

@t1m0thyj

Description

@t1m0thyj

Is your feature or enhancement request related to a problem or limitation? Please describe

For the Zowe Explorer FTP extension, we would like the ability to disable wildcard filtering, since the Zowe Explorer tree doesn't support it.

Describe your enhancement idea

Make the client-side wildcard filtering for UssUtils.listFiles method optional so that extenders like ZE can opt out:

// Only support wildcard matching in file names as follows.
// "/dir1/dir2"
// "/dir1/dir2/file*" => /^file.*$/
// "/dir1/dir2/*suffix" => /^.*suffix$/
// "/dir1/dir2/file*suffix" => /^file.*suffix$/
let directoryToList = directory;
const slashPosN = directory.lastIndexOf("/");
let filter: (fileName: string) => boolean;
if (slashPosN !== -1) {
const lastPart = directory.substring(slashPosN + 1);
if (lastPart.indexOf("*") !== -1) {
directoryToList = directory.substring(0, slashPosN);
const pattern = "^" + lastPart.replace(/\*/g, ".*") + "$";
filter = (fileName: string) => (fileName.match(pattern) != null);
this.log.debug("Listing USS files in the directory '%s' with pattern '%s'", directoryToList, pattern);
}
}

Describe alternatives you've considered

Provide any additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Low Priority

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions