( id toolspkg.ToolID, input bundleActivateToolInput, scope toolspkg.Scope, )
| 268 | } |
| 269 | |
| 270 | func nativeBundleActivationScope( |
| 271 | id toolspkg.ToolID, |
| 272 | input bundleActivateToolInput, |
| 273 | scope toolspkg.Scope, |
| 274 | ) (bundlepkg.Scope, string, error) { |
| 275 | activationScope := bundlepkg.Scope(strings.TrimSpace(input.Scope)).Normalize() |
| 276 | if activationScope == "" { |
| 277 | activationScope = bundlepkg.ScopeGlobal |
| 278 | if strings.TrimSpace(scope.WorkspaceID) != "" { |
| 279 | activationScope = bundlepkg.ScopeWorkspace |
| 280 | } |
| 281 | } |
| 282 | if !scope.Operator && strings.TrimSpace(scope.WorkspaceID) != "" && activationScope != bundlepkg.ScopeWorkspace { |
| 283 | return "", "", nativeScopeMismatchError(id, "scope") |
| 284 | } |
| 285 | workspaceID := "" |
| 286 | if activationScope == bundlepkg.ScopeWorkspace { |
| 287 | resolved, err := nativeCallerWorkspaceInput(id, "workspace", input.Workspace, scope) |
| 288 | if err != nil { |
| 289 | return "", "", err |
| 290 | } |
| 291 | if strings.TrimSpace(resolved) == "" { |
| 292 | return "", "", nativeRequiredInputError(id, "workspace") |
| 293 | } |
| 294 | workspaceID = resolved |
| 295 | } else if strings.TrimSpace(input.Workspace) != "" { |
| 296 | return "", "", nativeScopeMismatchError(id, "workspace") |
| 297 | } |
| 298 | return activationScope, workspaceID, nil |
| 299 | } |
| 300 | |
| 301 | func nativeBundleActivationsForScope( |
| 302 | scope toolspkg.Scope, |
no test coverage detected