Skip to content

Commit 2c55afa

Browse files
committed
feat: improve example
1 parent 7a58b96 commit 2c55afa

12 files changed

Lines changed: 60 additions & 14 deletions

File tree

src/commands/folders/create.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import {
1414

1515
export default class Create extends HackMDCommand {
1616
static description = 'Create a folder'
17+
static examples = [
18+
`$ hackmd-cli folders create --name='docs' --parentFolderId=fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c --description='Docs' --icon=1F600 --color=blue
19+
ID Name Parent Folder ID Color Description Icon
20+
──────────────────────────────────── ──── ──────────────────────────────────── ───── ─────────── ─────
21+
a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d docs fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c blue Docs 1F600`,
22+
]
1723
static flags = {
1824
color: folderColor,
1925
description: folderDescription,
@@ -45,16 +51,16 @@ export default class Create extends HackMDCommand {
4551
const folder = await APIClient.createFolder(payload)
4652

4753
ux.table([folder], {
48-
color: {},
49-
description: {},
50-
icon: {},
5154
id: {
5255
header: 'ID',
5356
},
5457
name: {},
5558
parentFolderId: {
5659
header: 'Parent Folder ID',
5760
},
61+
color: {},
62+
description: {},
63+
icon: {},
5864
}, {
5965
printLine: this.log.bind(this),
6066
...flags,

src/commands/folders/delete.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import {folderId} from '../../flags'
55

66
export default class Delete extends HackMDCommand {
77
static description = 'Delete a folder'
8+
static examples = [
9+
'$ hackmd-cli folders delete --folderId=a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d',
10+
]
811
static flags = {
912
folderId,
1013
help: Flags.help({char: 'h'}),

src/commands/folders/order.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import {parseFolderOrder} from '../../utils'
66

77
export default class Order extends HackMDCommand {
88
static description = 'Get or update folder order'
9+
static examples = [
10+
'$ hackmd-cli folders order',
11+
`$ hackmd-cli folders order --order='{"root":["91722050-bf47-4334-9e5d-87125a724c29","fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c"]}'`,
12+
]
913
static flags = {
1014
help: Flags.help({char: 'h'}),
1115
order: folderOrder,

src/commands/folders/update.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import {
1414

1515
export default class Update extends HackMDCommand {
1616
static description = 'Update folder'
17+
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=blue
19+
ID Name Parent Folder ID Color Description Icon
20+
──────────────────────────────────── ──── ──────────────────────────────────── ───── ─────────── ─────
21+
a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d docs fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c blue Docs 1F600`,
22+
]
1723
static flags = {
1824
color: folderColor,
1925
description: folderDescription,
@@ -46,16 +52,16 @@ export default class Update extends HackMDCommand {
4652
const folder = await APIClient.updateFolder(folderId, payload)
4753

4854
ux.table([folder], {
49-
color: {},
50-
description: {},
51-
icon: {},
5255
id: {
5356
header: 'ID',
5457
},
5558
name: {},
5659
parentFolderId: {
5760
header: 'Parent Folder ID',
5861
},
62+
color: {},
63+
description: {},
64+
icon: {},
5965
}, {
6066
printLine: this.log.bind(this),
6167
...flags,

src/commands/notes/create.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default class CreateCommand extends HackMDCommand {
2323
static description = 'Create a note'
2424
static examples = [
2525
"notes create --content='# A new note' --readPermission=owner --writePermission=owner --commentPermission=disabled",
26+
"notes create --parentFolderId=fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c --content='# A new note' --readPermission=owner --writePermission=owner --commentPermission=disabled",
2627

2728
`ID Title User Path Team Path
2829
────────────────────── ──────────────────────────────── ────────────────────── ────────

src/commands/notes/update.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default class Update extends HackMDCommand {
99
static description = 'Update note content'
1010
static examples = [
1111
"$ hackmd-cli notes update --noteId=WNkLM6gkS0Cg2cQ8rv7bYA --content='# A new title'",
12+
"$ hackmd-cli notes update --noteId=WNkLM6gkS0Cg2cQ8rv7bYA --parentFolderId=fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c --content='# A new title'",
1213
]
1314
static flags = {
1415
content: noteContent,

src/commands/team-folders/create.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ import {
1414

1515
export default class Create extends HackMDCommand {
1616
static description = 'Create a team folder'
17+
static examples = [
18+
`$ hackmd-cli team-folders create --teamPath=CLI-test --name='team-docs' --parentFolderId=fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c --description='Docs' --icon=1F600 --color=blue
19+
ID Name Parent Folder ID Color Description Icon
20+
──────────────────────────────────── ───────── ──────────────────────────────────── ───── ─────────── ─────
21+
a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d team-docs fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c blue Docs 1F600`,
22+
]
1723
static flags = {
1824
color: folderColor,
1925
description: folderDescription,
@@ -50,16 +56,16 @@ export default class Create extends HackMDCommand {
5056
const folder = await APIClient.createTeamFolder(teamPath, payload)
5157

5258
ux.table([folder], {
53-
color: {},
54-
description: {},
55-
icon: {},
5659
id: {
5760
header: 'ID',
5861
},
5962
name: {},
6063
parentFolderId: {
6164
header: 'Parent Folder ID',
6265
},
66+
color: {},
67+
description: {},
68+
icon: {},
6369
}, {
6470
printLine: this.log.bind(this),
6571
...flags,

src/commands/team-folders/delete.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import {folderId, teamPath} from '../../flags'
55

66
export default class Delete extends HackMDCommand {
77
static description = 'Delete a team folder'
8+
static examples = [
9+
'$ hackmd-cli team-folders delete --teamPath=CLI-test --folderId=a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d',
10+
]
811
static flags = {
912
folderId,
1013
help: Flags.help({char: 'h'}),

src/commands/team-folders/order.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import {parseFolderOrder} from '../../utils'
66

77
export default class Order extends HackMDCommand {
88
static description = 'Get or update team folder order'
9+
static examples = [
10+
'$ hackmd-cli team-folders order --teamPath=CLI-test',
11+
`$ hackmd-cli team-folders order --teamPath=CLI-test --order='{"root":["91722050-bf47-4334-9e5d-87125a724c29","fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c"]}'`,
12+
]
913
static flags = {
1014
help: Flags.help({char: 'h'}),
1115
order: folderOrder,

src/commands/team-folders/update.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@ import {
1515

1616
export default class Update extends HackMDCommand {
1717
static description = 'Update team folder'
18+
static examples = [
19+
`$ hackmd-cli team-folders update --teamPath=CLI-test --folderId=a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d --name='team-docs' --parentFolderId=fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c --description='Docs' --icon=1F600 --color=blue
20+
ID Name Parent Folder ID Color Description Icon
21+
──────────────────────────────────── ───────── ──────────────────────────────────── ───── ─────────── ─────
22+
a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d team-docs fc7a3d48-4a07-4cbf-bf4f-e65dd896e01c blue Docs 1F600`,
23+
]
1824
static flags = {
1925
color: folderColor,
2026
description: folderDescription,
@@ -52,16 +58,16 @@ export default class Update extends HackMDCommand {
5258
const folder = await APIClient.updateTeamFolder(teamPath, folderId, payload)
5359

5460
ux.table([folder], {
55-
color: {},
56-
description: {},
57-
icon: {},
5861
id: {
5962
header: 'ID',
6063
},
6164
name: {},
6265
parentFolderId: {
6366
header: 'Parent Folder ID',
6467
},
68+
color: {},
69+
description: {},
70+
icon: {},
6571
}, {
6672
printLine: this.log.bind(this),
6773
...flags,

0 commit comments

Comments
 (0)