Skip to content

Commit

Permalink
Merge branch 'master' of github.com:iann0036/former2
Browse files Browse the repository at this point in the history
  • Loading branch information
iann0036 committed Aug 17, 2022
2 parents edcd68b + 4df091a commit 4727d34
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Options:
--output-raw-data <filename> filename for debug output (full)
--output-logical-id-mapping <filename> filename for logical to physical id mapping
--cfn-deletion-policy <Delete|Retain> add DeletionPolicy in CloudFormation output
--search-filter <value> search filter for discovered resources (can be comma separated)
--search-filter <value> search filter for discovered resources ('or search' can be comma separated, 'and search' can be '&' separated.)
--services <value> list of services to include (can be comma separated (default: ALL))
--exclude-services <value> list of services to exclude (can be comma separated)
--sort-output sort resources by their ID before outputting
Expand Down
11 changes: 11 additions & 0 deletions cli/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ var resource_tag_cache = {};
const iaclangselect = "typescript";

function $(selector) { return new $obj(selector) }
const isAllIncludes = (arr, target) => arr.every(el => target.includes(el));
$obj = function (selector) { };
$obj.prototype.bootstrapTable = function (action, data) {
if (action == "append") {
Expand Down Expand Up @@ -250,6 +251,16 @@ async function main(opts) {
break;
}
}
} else if (opts.searchFilter.includes("&")) {
const searchWords = opts.searchFilter.split("&")
if (isAllIncludes(searchWords, jsonres)) {
output_objects.push({
'id': cli_resources[i].f2id,
'type': cli_resources[i].f2type,
'data': cli_resources[i].f2data,
'region': cli_resources[i].f2region
});
}
} else {
if (jsonres.includes(opts.searchFilter)) {
output_objects.push({
Expand Down

0 comments on commit 4727d34

Please sign in to comment.