File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Flags } from '@oclif/core'
2+
3+ import HackMDCommand from '../command'
4+ import { noteId } from '../flags'
5+
6+ export default class Export extends HackMDCommand {
7+ static description = 'Export note content'
8+
9+ static examples = [
10+ `$ hackmd-cli export --noteId=kNFWV5E-Qz-QP7u6XnNvyQ
11+ # A note to be exported
12+ ` ,
13+ ]
14+
15+ static flags = {
16+ help : Flags . help ( { char : 'h' } ) ,
17+ noteId : noteId ( )
18+ }
19+
20+ async run ( ) {
21+ const { flags} = await this . parse ( Export )
22+ const { noteId} = flags
23+
24+ if ( ! noteId ) {
25+ this . error ( 'Flag noteId could not be empty' )
26+ }
27+
28+ try {
29+ const APIClient = await this . getAPIClient ( )
30+ const note = await APIClient . getNote ( noteId )
31+ this . log ( note . content )
32+ } catch ( e ) {
33+ this . log ( 'Export note content failed' )
34+ this . error ( e as Error )
35+ }
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments