-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathdelete.js
48 lines (40 loc) · 1.07 KB
/
delete.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
43
44
45
46
47
48
'use strict';
const BoxCommand = require('../../box-command');
const { Flags, Args } = require('@oclif/core');
class UsersDeleteCommand extends BoxCommand {
async run() {
const { flags, args } = await this.parse(UsersDeleteCommand);
let options = {};
if (flags.hasOwnProperty('notify')) {
options.notify = flags.notify;
}
if (flags.hasOwnProperty('force')) {
options.force = flags.force;
}
await this.client.users.delete(args.id, options);
this.info(`Deleted user ${args.id}`);
}
}
UsersDeleteCommand.description = 'Delete a Box User';
UsersDeleteCommand.examples = ['box users:delete 33333'];
UsersDeleteCommand._endpoint = 'delete_users_id';
UsersDeleteCommand.flags = {
...BoxCommand.flags,
notify: Flags.boolean({
description: 'The user should be notified',
allowNo: true
}),
force: Flags.boolean({
char: 'f',
description: 'Delete user even if they own files',
}),
};
UsersDeleteCommand.args = {
id: Args.string({
name: 'id',
required: true,
hidden: false,
description: 'User ID to delete',
}),
};
module.exports = UsersDeleteCommand;