File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { Command , flags } from '@oclif/command'
2- import cli from 'cli-ux'
3-
1+ import { Command , Flags , CliUx } from '@oclif/core'
42import { APIClient } from '../api'
53
64export default class Teams extends Command {
7- static description = 'HackMD Teams Command '
5+ static description = 'List teams '
86
97 static examples = [
108 `$ hackmd-cli teams
11-
12- Path Name
13- team1 Team 1
14- my-awesome-team My Awesome Team` ,
9+ ID Name Path Owner ID
10+ ──────────────────────────────────── ───────────── ──────── ────────────────────────────────────
11+ f76308a6-d77a-41f6-86d0-8ada426a6fb4 CLI test team CLI-test 82f7f3d9-4079-4c78-8a00-14094272ece9 ` ,
1512 ]
1613
1714 static flags = {
18- help : flags . help ( { char : 'h' } ) ,
19- ...cli . table . flags ( )
15+ help : Flags . help ( { char : 'h' } ) ,
16+ ...CliUx . ux . table . flags ( ) ,
2017 }
2118
2219 async run ( ) {
23- if ( ! APIClient . enterprise ) {
24- return this . log ( 'Teams command only works on HackMD EE instance' )
25- }
26-
20+ const { flags} = await this . parse ( Teams )
21+
2722 try {
28- const teams = await APIClient . getTeams ( )
23+ const notes = await APIClient . getTeams ( )
2924
30- cli . table ( teams , {
31- path : {
32- header : 'Path ' ,
25+ CliUx . ux . table ( notes , {
26+ id : {
27+ header : 'ID ' ,
3328 } ,
34- name : { }
29+ name :{ } ,
30+ path : { } ,
31+ ownerId : {
32+ header : 'Owner ID'
33+ }
3534 } , {
36- printLine : this . log ,
35+ printLine : this . log . bind ( this ) ,
3736 ...flags
3837 } )
39- } catch ( err ) {
38+ } catch ( e ) {
4039 this . log ( 'Fetch teams failed' )
41- this . error ( err )
40+ this . error ( e )
4241 }
4342 }
4443}
You can’t perform that action at this time.
0 commit comments