setDefaultGroup.ts 736 B

12345678910111213141516171819202122
  1. import WorkingGroupsCommandBase from '../../base/WorkingGroupsCommandBase'
  2. import chalk from 'chalk'
  3. import ExitCodes from '../../ExitCodes'
  4. export default class SetDefaultGroupCommand extends WorkingGroupsCommandBase {
  5. static description = 'Change the default group context for working-groups commands.'
  6. static flags = { ...WorkingGroupsCommandBase.flags }
  7. async run() {
  8. const {
  9. flags: { group },
  10. } = this.parse(SetDefaultGroupCommand)
  11. if (!group) {
  12. this.error('--group flag is required', { exit: ExitCodes.InvalidInput })
  13. }
  14. await this.setPreservedState({ defaultWorkingGroup: group })
  15. this.log(chalk.green(`${chalk.white(group)} succesfully set as default working group context`))
  16. }
  17. }