-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathdelete.ts
More file actions
32 lines (27 loc) · 773 Bytes
/
delete.ts
File metadata and controls
32 lines (27 loc) · 773 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
30
31
32
import {Flags} from '@oclif/core'
import HackMDCommand from '../../command'
import {folderId} from '../../flags'
export default class Delete extends HackMDCommand {
static description = 'Delete a folder'
static examples = [
'$ hackmd-cli folders delete --folderId=a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d',
]
static flags = {
folderId,
help: Flags.help({char: 'h'}),
}
async run() {
const {flags} = await this.parse(Delete)
const {folderId} = flags
if (!folderId) {
this.error('Flag folderId could not be empty')
}
try {
const APIClient = await this.getAPIClient()
await APIClient.deleteFolder(folderId)
} catch (error) {
this.log('Delete folder failed')
this.error(error as Error)
}
}
}