@@ -256,17 +256,18 @@ func manageNamedEntities(cmd *cobra.Command, clients *shared.ClientFactory, toke
256256 }
257257
258258 if accessNamedEntities > 0 {
259- if accessAction == "grant" {
259+ switch accessAction {
260+ case "grant" :
260261 accessFlags .grant = true
261262 if ! cmdutil .IsFlagChanged (cmd , "include-app-collaborators" ) && currentAccessType != types .PermissionNamedEntities {
262263 includeAppCollaborators , err = prompts .AddAppCollaboratorsToNamedEntitiesPrompt (ctx , clients .IO )
263264 if err != nil {
264265 return err
265266 }
266267 }
267- } else if accessAction == "revoke" {
268+ case "revoke" :
268269 accessFlags .revoke = true
269- } else {
270+ default :
270271 return nil
271272 }
272273 } else {
@@ -563,13 +564,14 @@ func printAccess(cmd *cobra.Command, clients *shared.ClientFactory, token string
563564 return err
564565 }
565566
566- if accessType == types .PermissionEveryone {
567+ switch accessType {
568+ case types .PermissionEveryone :
567569 var everyoneAccessTypeDescription = types .GetAccessTypeDescriptionForEveryone (app )
568570 clients .IO .PrintInfo (ctx , false , "\n Trigger '%s' can be found and run by %s" , accessFlags .triggerID , everyoneAccessTypeDescription )
569- } else if accessType == types .PermissionAppCollaborators {
571+ case types .PermissionAppCollaborators :
570572 clients .IO .PrintInfo (ctx , false , "\n Trigger '%s' can be found and run by %s:" , accessFlags .triggerID , style .Pluralize ("app collaborator" , "app collaborators" , len (userAccessList )))
571573 err = printAppCollaboratorsHelper (cmd , clients , token , userAccessList )
572- } else if accessType == types .PermissionNamedEntities {
574+ case types .PermissionNamedEntities :
573575 err = printNamedEntitiesHelper (cmd , clients , token , userAccessList , "list" )
574576 }
575577 clients .IO .PrintTrace (ctx , slacktrace .TriggersAccessSuccess )
@@ -581,16 +583,17 @@ func printCurrentAuthorizedEntities(cmd *cobra.Command, clients *shared.ClientFa
581583 ctx := cmd .Context ()
582584
583585 cmd .Println ()
584- if currentAccessType == types .PermissionEveryone {
586+ switch currentAccessType {
587+ case types .PermissionEveryone :
585588 var everyoneAccessTypeDescription = types .GetAccessTypeDescriptionForEveryone (app )
586589 clients .IO .PrintInfo (ctx , false , "Trigger '%s' can be found and run by %s\n " , accessFlags .triggerID , everyoneAccessTypeDescription )
587- } else if currentAccessType == ( types .PermissionAppCollaborators ) {
590+ case types .PermissionAppCollaborators :
588591 clients .IO .PrintInfo (ctx , false , "Access is currently granted to %s:" , style .Pluralize ("app collaborator" , "app collaborators" , len (currentAccessList )))
589592 err := printAppCollaboratorsHelper (cmd , clients , token , currentAccessList )
590593 if err != nil {
591594 return err
592595 }
593- } else {
596+ case types . PermissionNamedEntities :
594597 err := printNamedEntitiesHelper (cmd , clients , token , currentAccessList , "manage" )
595598 if err != nil {
596599 return err
@@ -622,9 +625,10 @@ func printNamedEntitiesHelper(cmd *cobra.Command, clients *shared.ClientFactory,
622625 ctx := cmd .Context ()
623626
624627 if len (entitiesAccessList ) <= 0 {
625- if action == "manage" {
628+ switch action {
629+ case "manage" :
626630 clients .IO .PrintInfo (ctx , false , "Access is currently granted:" )
627- } else if action == "list" {
631+ case "list" :
628632 clients .IO .PrintInfo (ctx , false , "\n Trigger '%s' can be found and run by:" , accessFlags .triggerID )
629633 }
630634 clients .IO .PrintInfo (ctx , false , "nobody" )
@@ -635,9 +639,10 @@ func printNamedEntitiesHelper(cmd *cobra.Command, clients *shared.ClientFactory,
635639
636640 if len (namedEntitiesAccessMap ["users" ]) > 0 {
637641 var userLabel = style .Pluralize ("this user" , "these users" , len (namedEntitiesAccessMap ["users" ]))
638- if action == "manage" {
642+ switch action {
643+ case "manage" :
639644 clients .IO .PrintInfo (ctx , false , "\n Access is currently granted to %s:" , userLabel )
640- } else if action == "list" {
645+ case "list" :
641646 clients .IO .PrintInfo (ctx , false , "\n Trigger '%s' can be found and run by %s:" , accessFlags .triggerID , userLabel )
642647 }
643648 for _ , entity := range namedEntitiesAccessMap ["users" ] {
@@ -650,9 +655,10 @@ func printNamedEntitiesHelper(cmd *cobra.Command, clients *shared.ClientFactory,
650655 }
651656 if len (namedEntitiesAccessMap ["channels" ]) > 0 {
652657 var channelLabel = style .Pluralize ("this channel" , "these channels" , len (namedEntitiesAccessMap ["channels" ]))
653- if action == "manage" {
658+ switch action {
659+ case "manage" :
654660 clients .IO .PrintInfo (ctx , false , "\n Access is currently granted to all members of %s:" , channelLabel )
655- } else if action == "list" {
661+ case "list" :
656662 clients .IO .PrintInfo (ctx , false , "\n Trigger '%s' can be found and run by all members of %s:" , accessFlags .triggerID , channelLabel )
657663 }
658664 for _ , entity := range namedEntitiesAccessMap ["channels" ] {
@@ -665,9 +671,10 @@ func printNamedEntitiesHelper(cmd *cobra.Command, clients *shared.ClientFactory,
665671 }
666672 if len (namedEntitiesAccessMap ["teams" ]) > 0 {
667673 var teamLabel = style .Pluralize ("this workspace" , "these workspaces" , len (namedEntitiesAccessMap ["teams" ]))
668- if action == "manage" {
674+ switch action {
675+ case "manage" :
669676 clients .IO .PrintInfo (ctx , false , "\n Access is currently granted to all members of %s:" , teamLabel )
670- } else if action == "list" {
677+ case "list" :
671678 clients .IO .PrintInfo (ctx , false , "\n Trigger '%s' can be found and run by all members of %s:" , accessFlags .triggerID , teamLabel )
672679 }
673680 for _ , entity := range namedEntitiesAccessMap ["teams" ] {
@@ -680,9 +687,10 @@ func printNamedEntitiesHelper(cmd *cobra.Command, clients *shared.ClientFactory,
680687 }
681688 if len (namedEntitiesAccessMap ["organizations" ]) > 0 {
682689 var orgLabel = style .Pluralize ("this organization" , "these organizations" , len (namedEntitiesAccessMap ["organizations" ]))
683- if action == "manage" {
690+ switch action {
691+ case "manage" :
684692 clients .IO .PrintInfo (ctx , false , "\n Access is currently granted to all members of %s:" , orgLabel )
685- } else if action == "list" {
693+ case "list" :
686694 clients .IO .PrintInfo (ctx , false , "\n Trigger '%s' can be found and run by all members of %s:" , accessFlags .triggerID , orgLabel )
687695 }
688696 for _ , entity := range namedEntitiesAccessMap ["organizations" ] {
0 commit comments