Skip to content

Commit 79cb479

Browse files
committed
Import markdown file to team
1 parent 3c2c2d3 commit 79cb479

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/commands/import.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default class Import extends Command {
88
static description = 'Create a note from markdown file'
99

1010
static examples = [
11-
`$ hackmd-cli import /path/to/markdown/file.md
11+
`$ hackmd-cli import /path/to/markdown/file.md --team=xxx
1212
1313
Your note is available at https://hackmd.io/note-url
1414
`,
@@ -20,14 +20,24 @@ Your note is available at https://hackmd.io/note-url
2020

2121
static flags = {
2222
help: flags.help({char: 'h'}),
23+
team: flags.string({
24+
char: 't',
25+
default: '',
26+
description: 'team to use',
27+
required: false
28+
})
2329
}
2430

2531
async run() {
26-
const {args} = this.parse(Import)
32+
const {args, flags} = this.parse(Import)
33+
34+
if (!args.file) {
35+
return this.log('No file path specified.')
36+
}
2737

2838
const content = fs.readFileSync(path.resolve(process.cwd(), args.file), 'utf-8')
2939
try {
30-
const url = await APIClient.newNote(content)
40+
const url = await APIClient.newNote(content, {team: flags.team})
3141
this.log(`Your note is available at ${url}`)
3242
} catch (err) {
3343
this.error(err)

0 commit comments

Comments
 (0)