• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mongodb / mongodb-atlas-cli / 26228926989

21 May 2026 01:27PM UTC coverage: 22.63% (-41.6%) from 64.198%
26228926989

push

github

apix-bot[bot]
Update compliance report for v1.55.0

8987 of 39713 relevant lines covered (22.63%)

0.25 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/internal/cli/plugin/uninstall.go
1
// Copyright 2024 MongoDB Inc
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//      http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15
package plugin
16

17
import (
18
        "fmt"
19

20
        "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli"
21
        "github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli/require"
22
        "github.com/spf13/cobra"
23
)
24

25
type UninstallOpts struct {
26
        cli.OutputOpts
27
        Opts
28
        pluginArg string
29
}
30

31
func (opts *UninstallOpts) Run() error {
×
32
        pluginToUninstall, err := opts.findPluginWithArg(opts.pluginArg)
×
33
        if err != nil {
×
34
                return err
×
35
        }
×
36

37
        err = pluginToUninstall.Uninstall()
×
38
        if err != nil {
×
39
                return fmt.Errorf(`plugin %s could not be uninstalled: %w`, pluginToUninstall.Name, err)
×
40
        }
×
41

42
        return opts.Print(fmt.Sprintf("Plugin %s uninstalled successfully", pluginToUninstall.Name))
×
43
}
44

45
func UninstallBuilder(pluginOpts *Opts) *cobra.Command {
×
46
        opts := &UninstallOpts{}
×
47
        opts.Opts = *pluginOpts
×
48

×
49
        const use = "uninstall"
×
50
        cmd := &cobra.Command{
×
51
                Use:     use + " [plugin]",
×
52
                Aliases: cli.GenerateAliases(use),
×
53
                Annotations: map[string]string{
×
54
                        "pluginDesc": "Plugin identifier.",
×
55
                },
×
56
                Short: "Uninstall Atlas CLI plugin.",
×
57
                Long: `Uninstall an Atlas CLI plugin.
×
58
You can specify a plugin to uninstall using either the "<github-owner>/<github-repository-name>" format or the plugin name.
×
59
`,
×
60
                Args: require.ExactArgs(1),
×
61
                Example: `  # Uninstall a plugin:
×
62
  atlas plugin uninstall mongodb/atlas-cli-plugin-example
×
63
  atlas plugin uninstall atlas-cli-plugin-example`,
×
64
                PreRun: func(_ *cobra.Command, arg []string) {
×
65
                        opts.pluginArg = arg[0]
×
66
                },
×
67
                RunE: func(_ *cobra.Command, _ []string) error {
×
68
                        return opts.Run()
×
69
                },
×
70
        }
71

72
        return cmd
×
73
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc