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

mlange-42 / modo / 13179389384

06 Feb 2025 01:02PM CUT coverage: 56.505% (-17.6%) from 74.08%
13179389384

Pull #212

github

web-flow
Merge 82bca64de into 1566231bf
Pull Request #212: Add tests for CLI commands

1772 of 3136 relevant lines covered (56.51%)

21.11 hits per line

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

0.0
/internal/cmd/root.go
1
package cmd
2

3
import (
4
        "fmt"
5

6
        "github.com/spf13/cobra"
7
)
8

9
func RootCommand() (*cobra.Command, error) {
×
10
        var showVersion bool
×
11

×
12
        root := &cobra.Command{
×
13
                Use:   "modo",
×
14
                Short: "Modo -- DocGen for Mojo.",
×
15
                Long: `Modo -- DocGen for Mojo.
×
16

×
17
Modo generates Markdown for static site generators (SSGs) from 'mojo doc' JSON output.
×
18

×
19
Complete documentation at https://mlange-42.github.io/modo/`,
×
20
                Example: `  modo init hugo                 # set up a project, e.g. for Hugo
×
21
  modo build                     # build the docs`,
×
22
                Args:         cobra.ExactArgs(0),
×
23
                SilenceUsage: true,
×
24
                Run: func(cmd *cobra.Command, args []string) {
×
25
                        if showVersion {
×
26
                                fmt.Printf("Modo %s\n", version.Version())
×
27
                        }
×
28
                },
29
        }
30

31
        root.CompletionOptions.HiddenDefaultCmd = true
×
32

×
33
        for _, fn := range []func() (*cobra.Command, error){initCommand, buildCommand, testCommand, cleanCommand} {
×
34
                cmd, err := fn()
×
35
                if err != nil {
×
36
                        return nil, err
×
37
                }
×
38
                root.AddCommand(cmd)
×
39
        }
40

41
        root.Flags().BoolVarP(&showVersion, "version", "V", false, "")
×
42

×
43
        return root, nil
×
44
}
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

© 2025 Coveralls, Inc