-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathmove.js
48 lines (40 loc) · 1.1 KB
/
move.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 FoldersMoveCommand extends BoxCommand {
async run() {
const { flags, args } = await this.parse(FoldersMoveCommand);
let updates = {
parent: {
id: args.parentID,
},
};
if (flags.etag) {
updates.etag = flags.etag;
}
let movedFolder = await this.client.folders.update(args.id, updates);
await this.output(movedFolder);
}
}
FoldersMoveCommand.description = 'Move a folder to a different folder';
FoldersMoveCommand.examples = ['box folders:move 22222 44444'];
FoldersMoveCommand._endpoint = 'put_folders_id move';
FoldersMoveCommand.flags = {
...BoxCommand.flags,
etag: Flags.string({ description: 'Only move if etag value matches' }),
};
FoldersMoveCommand.args = {
id: Args.string({
name: 'id',
required: true,
hidden: false,
description: 'ID of folder to copy',
}),
parentID: Args.string({
name: 'parentID',
required: true,
hidden: false,
description: 'ID of the new parent folder to move the folder into',
})
};
module.exports = FoldersMoveCommand;