-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathcopy.js
47 lines (39 loc) · 1.17 KB
/
copy.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
'use strict';
const BoxCommand = require('../../box-command');
const { Flags, Args } = require('@oclif/core');
class FoldersCopyCommand extends BoxCommand {
async run() {
const { flags, args } = await this.parse(FoldersCopyCommand);
let options = {};
if (flags.name) {
options.name = flags.name;
}
let folderCopy = await this.client.folders.copy(args.id, args.parentID, options);
await this.output(folderCopy);
}
}
FoldersCopyCommand.description = 'Copy a folder to a different folder';
FoldersCopyCommand.examples = ['box folders:copy 22222 44444'];
FoldersCopyCommand._endpoint = 'post_folders_id_copy';
FoldersCopyCommand.flags = {
...BoxCommand.flags,
name: Flags.string({ description: 'An optional new name for the folder' }),
'id-only': Flags.boolean({
description: 'Return only an ID to output from this command',
}),
};
FoldersCopyCommand.args = {
id: Args.string({
name: 'id',
required: true,
hidden: false,
description: 'ID of the folder to copy',
}),
parentID: Args.string({
name: 'parentID',
required: true,
hidden: false,
description: 'ID of the new parent folder to copy the folder into',
})
};
module.exports = FoldersCopyCommand;