Skip to content

Commit fa907aa

Browse files
committed
Change output format for code search
1 parent 0268f0c commit fa907aa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

core/cb.search/code.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ var assembleCommand = function(options) {
8181
var search = function(root, args) {
8282
var d = Q.defer(), prevfile = null;
8383
var results = {};
84+
var nMatches = 0;
8485

8586
args = _.defaults(args || {}, {
8687
pattern: null,
@@ -124,6 +125,7 @@ var search = function(root, args) {
124125
'line': _line,
125126
'content': parts.join(":")
126127
});
128+
nMatches = nMatches + 1;
127129
}
128130
});
129131

@@ -134,7 +136,11 @@ var search = function(root, args) {
134136
if (code !== 0) {
135137
d.reject(new Error("ack exited with code "+code));
136138
} else {
137-
d.resolve(results);
139+
d.resolve({
140+
'options': args,
141+
'files': results,
142+
'matches': nMatches
143+
});
138144
}
139145
});
140146

0 commit comments

Comments
 (0)