Skip to content

Commit ab0cc05

Browse files
committed
fix: update folder should return silent
1 parent 11c3ced commit ab0cc05

2 files changed

Lines changed: 6 additions & 66 deletions

File tree

src/commands/folders/update.ts

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type {UpdateUserFolderBody} from '@hackmd/api'
22

3-
import {Flags, ux} from '@oclif/core'
3+
import {Flags} from '@oclif/core'
44

55
import HackMDCommand from '../../command'
66
import {
@@ -15,10 +15,7 @@ import {
1515
export default class Update extends HackMDCommand {
1616
static description = 'Update folder'
1717
static examples = [
18-
`$ hackmd-cli folders update --folderId=a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d --name='docs' --parentFolderId=fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c --description='Docs' --icon=1F600 --color=#4F46E5
19-
ID Name Parent Folder ID Color Description Icon
20-
──────────────────────────────────── ──── ──────────────────────────────────── ─────── ─────────── ─────
21-
a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d docs fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c #4F46E5 Docs 1F600`,
18+
"$ hackmd-cli folders update --folderId=a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d --name='docs' --parentFolderId=fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c --description='Docs' --icon=1F600 --color=#4F46E5",
2219
]
2320
static flags = {
2421
color: folderColor,
@@ -28,7 +25,6 @@ a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d docs fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c #
2825
icon: folderIcon,
2926
name: folderName,
3027
parentFolderId,
31-
...ux.table.flags(),
3228
}
3329

3430
async run() {
@@ -49,33 +45,7 @@ a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d docs fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c #
4945

5046
try {
5147
const APIClient = await this.getAPIClient()
52-
const folder = await APIClient.updateFolder(folderId, payload)
53-
54-
ux.table(
55-
[folder],
56-
Object.fromEntries([
57-
[
58-
'id',
59-
{
60-
header: 'ID',
61-
},
62-
],
63-
['name', {}],
64-
[
65-
'parentFolderId',
66-
{
67-
header: 'Parent Folder ID',
68-
},
69-
],
70-
['color', {}],
71-
['description', {}],
72-
['icon', {}],
73-
]),
74-
{
75-
printLine: this.log.bind(this),
76-
...flags,
77-
},
78-
)
48+
await APIClient.updateFolder(folderId, payload)
7949
} catch (error) {
8050
this.log('Update folder failed')
8151
this.error(error as Error)

src/commands/team-folders/update.ts

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type {UpdateTeamFolderBody} from '@hackmd/api'
22

3-
import {Flags, ux} from '@oclif/core'
3+
import {Flags} from '@oclif/core'
44

55
import HackMDCommand from '../../command'
66
import {
@@ -21,10 +21,7 @@ export default class Update extends HackMDCommand {
2121
'--folderId=a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d ',
2222
"--name='team-docs' ",
2323
'--parentFolderId=fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c ',
24-
"--description='Docs' --icon=1F600 --color=#4F46E5\n",
25-
'ID Name Parent Folder ID Color Description Icon\n',
26-
'──────────────────────────────────── ───────── ──────────────────────────────────── ─────── ─────────── ─────\n',
27-
'a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d team-docs fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c #4F46E5 Docs 1F600',
24+
"--description='Docs' --icon=1F600 --color=#4F46E5",
2825
].join(''),
2926
]
3027
static flags = {
@@ -36,7 +33,6 @@ export default class Update extends HackMDCommand {
3633
name: folderName,
3734
parentFolderId,
3835
teamPath,
39-
...ux.table.flags(),
4036
}
4137

4238
async run() {
@@ -61,33 +57,7 @@ export default class Update extends HackMDCommand {
6157

6258
try {
6359
const APIClient = await this.getAPIClient()
64-
const folder = await APIClient.updateTeamFolder(teamPath, folderId, payload)
65-
66-
ux.table(
67-
[folder],
68-
Object.fromEntries([
69-
[
70-
'id',
71-
{
72-
header: 'ID',
73-
},
74-
],
75-
['name', {}],
76-
[
77-
'parentFolderId',
78-
{
79-
header: 'Parent Folder ID',
80-
},
81-
],
82-
['color', {}],
83-
['description', {}],
84-
['icon', {}],
85-
]),
86-
{
87-
printLine: this.log.bind(this),
88-
...flags,
89-
},
90-
)
60+
await APIClient.updateTeamFolder(teamPath, folderId, payload)
9161
} catch (error) {
9262
this.log('Update team folder failed')
9363
this.error(error as Error)

0 commit comments

Comments
 (0)