-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathsearch.js
42 lines (34 loc) · 1000 Bytes
/
search.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
'use strict';
const BoxCommand = require('../../box-command');
const UsersListCommand = require('.'); // This points to ./index.js
const UserModule = require('../../modules/user');
const _ = require('lodash');
const { Args } = require('@oclif/core');
class UsersSearchCommand extends BoxCommand {
async run() {
const { flags, args } = await this.parse(UsersSearchCommand);
flags.filter = args.name;
let userModule = new UserModule(this.client);
let users = await userModule.listUsers(flags);
await this.output(users);
}
}
UsersSearchCommand.description = 'Search for Box users';
UsersSearchCommand.examples = ['box users:search "John Doe"'];
UsersSearchCommand.flags = {
...BoxCommand.flags,
..._.pick(UsersListCommand.flags, [
'managed-users',
'external-users',
'all-users'
]),
};
UsersSearchCommand.args = {
name: Args.string({
name: 'name',
required: true,
hidden: false,
description: 'Name of user to search for'
}),
};
module.exports = UsersSearchCommand;