File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Command , flags } from '@oclif/command'
2+ import cli from 'cli-ux'
3+
4+ import { APIClient } from '../api'
5+
6+ export default class Teams extends Command {
7+ static description = 'HackMD Teams Command'
8+
9+ static examples = [
10+ `$ hackmd-cli teams
11+
12+ Path Name
13+ team1 Team 1
14+ my-awesome-team My Awesome Team` ,
15+ ]
16+
17+ static flags = {
18+ help : flags . help ( { char : 'h' } ) ,
19+ ...cli . table . flags ( )
20+ }
21+
22+ async run ( ) {
23+ if ( ! APIClient . enterprise ) {
24+ return this . log ( 'Teams command only works on HackMD EE instance' )
25+ }
26+
27+ try {
28+ const teams = await APIClient . getTeams ( )
29+
30+ cli . table ( teams , {
31+ path : {
32+ header : 'Path' ,
33+ } ,
34+ name : { }
35+ } , {
36+ printLine : this . log ,
37+ ...flags
38+ } )
39+ } catch ( err ) {
40+ this . log ( 'Fetch teams failed' )
41+ this . error ( err )
42+ }
43+ }
44+ }
You can’t perform that action at this time.
0 commit comments