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

mongodb / mongodb-atlas-cli / 16772687316

06 Aug 2025 09:12AM UTC coverage: 64.656% (-3.2%) from 67.902%
16772687316

push

github

web-flow
chore: remove test tags (#4089)

0 of 11 new or added lines in 2 files covered. (0.0%)

1184 existing lines in 46 files now uncovered.

26448 of 40906 relevant lines covered (64.66%)

0.8 hits per line

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

93.94
/internal/cli/cli.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 cli
16

17
import (
18
        "strings"
19

20
        "github.com/spf13/cobra"
21
        "github.com/tangzero/inflector"
22
)
23

24
type AutoFunc func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)
25

26
// GenerateAliases return aliases for use such that they are:
27
// a version all lower case, a version with dashes, a singular versions with the same rules.
28
func GenerateAliases(use string, extra ...string) []string {
2✔
29
        aliases := make([]string, 0)
2✔
30

2✔
31
        if lower := strings.ToLower(use); lower != use {
4✔
32
                aliases = append(aliases, lower)
2✔
33
        }
2✔
34
        if dash := inflector.Dasherize(use); dash != use {
4✔
35
                aliases = append(aliases, dash)
2✔
36
        }
2✔
37
        if singular := inflector.Singularize(use); singular != use {
4✔
38
                aliases = append(aliases, singular)
2✔
39
                if lower := strings.ToLower(singular); lower != singular {
4✔
40
                        aliases = append(aliases, lower)
2✔
41
                }
2✔
42
                if dash := inflector.Dasherize(singular); dash != singular {
4✔
43
                        aliases = append(aliases, dash)
2✔
44
                }
2✔
45
        }
46
        aliases = append(aliases, extra...)
2✔
47
        return aliases
2✔
48
}
49

50
// ReturnValueForSetting returns a boolean value that is useful when working with boolean flags to inform
51
// whether the given option should be active or inactive.
52
func ReturnValueForSetting(enableFlag, disableFlag bool) *bool {
1✔
53
        var valueToSet bool
1✔
54
        if enableFlag && disableFlag {
1✔
UNCOV
55
                return nil
×
UNCOV
56
        }
×
57
        if enableFlag {
2✔
58
                valueToSet = true
1✔
59
                return &valueToSet
1✔
60
        }
1✔
61
        if disableFlag {
2✔
62
                valueToSet = false
1✔
63
                return &valueToSet
1✔
64
        }
1✔
65
        return nil
1✔
66
}
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