curatorGroups.ts 721 B

123456789101112131415161718192021222324
  1. import ContentDirectoryCommandBase from '../../base/ContentDirectoryCommandBase'
  2. // import chalk from 'chalk'
  3. import { displayTable } from '../../helpers/display'
  4. export default class CuratorGroupsCommand extends ContentDirectoryCommandBase {
  5. static description = 'List existing Curator Groups.'
  6. async run() {
  7. const groups = await this.getApi().availableCuratorGroups()
  8. if (groups.length) {
  9. displayTable(
  10. groups.map(([id, group]) => ({
  11. 'ID': id.toString(),
  12. 'Status': group.active.valueOf() ? 'Active' : 'Inactive',
  13. 'Members': group.curators.toArray().length,
  14. })),
  15. 5
  16. )
  17. } else {
  18. this.log('No Curator Groups available!')
  19. }
  20. }
  21. }