Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add regex support to Search.dataSets #2443

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,39 @@ Array [
"name": "timeout",
"type": "number",
},
Object {
"aliases": Array [
"re",
],
"defaultValue": false,
"description": "Whether the search string is a regular expression.",
"name": "regex",
"type": "boolean",
},
]
`;

exports[`zos-files search ds command definition should not have changed 2`] = `
Array [
Object {
"description": "Search all of IBMUSER's, data sets for 'ZOWE'",
"description": "Search all of IBMUSER's data sets for 'ZOWE'",
"options": "'IBMUSER.*' 'ZOWE'",
},
Object {
"description": "Search all of IBMUSER's, data sets for 'ZOWE' in uppercase only",
"description": "Search all of IBMUSER's data sets for 'ZOWE' in uppercase only",
"options": "'IBMUSER.*' 'ZOWE' --case-sensitive",
},
Object {
"description": "Search all of IBMUSER's, data sets for 'ZOWE', and time out in 1 minute",
"description": "Search all of IBMUSER's data sets for 'ZOWE', and time out in 1 minute",
"options": "'IBMUSER.*' 'ZOWE' --timeout 60",
},
Object {
"description": "Search all of IBMUSER's, data sets for 'ZOWE', and perform 8 parallel tasks",
"description": "Search all of IBMUSER's data sets for 'ZOWE', and perform 8 parallel tasks",
"options": "'IBMUSER.*' 'ZOWE' --max-concurrent-requests 8",
},
Object {
"description": "Search all of IBMUSER's data sets using a regular expression",
"options": "'IBMUSER.*' 'Z([A-Za-z]){3}' --regex",
},
]
`;
13 changes: 9 additions & 4 deletions packages/cli/src/zosfiles/-strings-/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,23 +649,28 @@ export default {
TIMEOUT: "The number of seconds to search before timing out.",
ENCODING: "Search the file content with encoding mode, which means that data conversion is performed using the file encoding " +
"specified.",
REGEX: "Whether the search string is a regular expression.",
},
EXAMPLES: {
EX1: {
DESCRIPTION: "Search all of IBMUSER's, data sets for 'ZOWE'",
DESCRIPTION: "Search all of IBMUSER's data sets for 'ZOWE'",
OPTIONS: "'IBMUSER.*' 'ZOWE'"
},
EX2: {
DESCRIPTION: "Search all of IBMUSER's, data sets for 'ZOWE' in uppercase only",
DESCRIPTION: "Search all of IBMUSER's data sets for 'ZOWE' in uppercase only",
OPTIONS: "'IBMUSER.*' 'ZOWE' --case-sensitive"
},
EX3: {
DESCRIPTION: "Search all of IBMUSER's, data sets for 'ZOWE', and time out in 1 minute",
DESCRIPTION: "Search all of IBMUSER's data sets for 'ZOWE', and time out in 1 minute",
OPTIONS: "'IBMUSER.*' 'ZOWE' --timeout 60"
},
EX4: {
DESCRIPTION: "Search all of IBMUSER's, data sets for 'ZOWE', and perform 8 parallel tasks",
DESCRIPTION: "Search all of IBMUSER's data sets for 'ZOWE', and perform 8 parallel tasks",
OPTIONS: "'IBMUSER.*' 'ZOWE' --max-concurrent-requests 8"
},
EX5: {
DESCRIPTION: "Search all of IBMUSER's data sets using a regular expression",
OPTIONS: "'IBMUSER.*' 'Z([A-Za-z]){3}' --regex"
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions packages/cli/src/zosfiles/search/ds/DataSets.definition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ export const DataSetsDefinition: ICommandDefinition = {
aliases: ["to"],
description: dataSetStrings.OPTIONS.TIMEOUT,
type: "number"
},
{
name: "regex",
aliases: ["re"],
description: dataSetStrings.OPTIONS.REGEX,
type: "boolean",
defaultValue: false
}
],
examples: [
Expand All @@ -97,6 +104,10 @@ export const DataSetsDefinition: ICommandDefinition = {
{
description: dataSetStrings.EXAMPLES.EX4.DESCRIPTION,
options: dataSetStrings.EXAMPLES.EX4.OPTIONS
},
{
description: dataSetStrings.EXAMPLES.EX5.DESCRIPTION,
options: dataSetStrings.EXAMPLES.EX5.OPTIONS
}
]
};
1 change: 1 addition & 0 deletions packages/cli/src/zosfiles/search/ds/DataSets.handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class DataSetsHandler extends ZosFilesBaseHandler {
mainframeSearch: commandParameters.arguments.mainframeSearch,
maxConcurrentRequests: commandParameters.arguments.maxConcurrentRequests,
caseSensitive: commandParameters.arguments.caseSensitive,
regex: commandParameters.arguments.regex,
progressTask: task,
getOptions: { encoding: commandParameters.arguments.encoding }
};
Expand Down
1 change: 1 addition & 0 deletions packages/zosfiles/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to the Zowe z/OS files SDK package will be documented in thi

## Recent Changes
- BugFix: Users were not warned when copying partitioned data sets with identical member names. Now, the user is prompted to confirm before continuing the copy operation to avoid potential data loss. [#2349] (https://github.com/zowe/zowe-cli/issues/2349)
- Enhancement: Add the ability to search data sets with regex patterns by passing `--regex` into the search command. [#2432](https://github.com/zowe/zowe-cli/issues/2432)

## `8.13.0`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -302,4 +302,4 @@ describe("Search", () => {
expect(response).not.toBeDefined();
});
});
});
});
Loading
Loading