-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathimplementations.js
More file actions
29 lines (28 loc) · 915 Bytes
/
Copy pathimplementations.js
File metadata and controls
29 lines (28 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { collectFile } from '../../db/query-builder.js';
import { EVERY_SYMBOL_KIND } from '../../domain/queries.js';
import { implementations } from '../../presentation/queries-cli.js';
export const command = {
name: 'implementations <name>',
description: 'List all concrete types implementing a given interface or trait',
queryOpts: true,
options: [
[
'-f, --file <path>',
'Scope search to symbols in this file (partial match, repeatable)',
collectFile,
],
['-k, --kind <kind>', 'Filter to a specific symbol kind'],
],
validate([_name], opts) {
if (opts.kind && !EVERY_SYMBOL_KIND.includes(opts.kind)) {
return `Invalid kind "${opts.kind}". Valid: ${EVERY_SYMBOL_KIND.join(', ')}`;
}
},
execute([name], opts, ctx) {
implementations(name, opts.db, {
file: opts.file,
kind: opts.kind,
...ctx.resolveQueryOpts(opts),
});
},
};