cloudcms-cli
Version:
Cloud CMS Command-Line client
70 lines (66 loc) • 2.43 kB
JavaScript
var helper = require("../../../helper");
var AbstractCommand = require("../../abstract");
class SearchNodesCommand extends AbstractCommand
{
constructor()
{
super({
"group": "branch",
"name": "search-nodes",
"description": "Searches for Nodes",
"schema": {
"properties": [{
"name": "repositoryId",
"type": "string",
"description": "Enter the repository ID",
"required": true,
"args": ["repository", "r"]
}, {
"name": "branchId",
"type": "string",
"description": "Enter the branch ID",
"required": true,
"args": ["branch", "b"]
}, {
"name": "query",
"type": "string",
"description": "Enter the query JSON",
"required": false,
"args": ["query", "q"]
}, {
"name": "text",
"type": "string",
"description": "Enter the text to search for",
"required": false,
"args": ["text", "t"]
}, {
"name": "skip",
"type": "number",
"description": "Enter the pagination skip",
"required": false,
"args": ["skip", "s"]
}, {
"name": "limit",
"type": "number",
"description": "Enter the pagination limit",
"required": false,
"args": ["limit", "l"]
}, {
"name": "sort",
"type": "string",
"description": "Enter the pagination sort JSON",
"required": false,
"args": ["sort", "x"]
}]
}
});
}
handle(options, callback)
{
// NOTE: options.fields not supported via elastic search (yet)
helper.searchNodes(options.repositoryId, options.branchId, options.query, options.text, options.skip, options.limit, options.sort, function(err) {
callback(err);
});
}
}
module.exports = SearchNodesCommand;