Skip to content

Commit

Permalink
added go-tool-dist
Browse files Browse the repository at this point in the history
  • Loading branch information
rsteube committed Jul 26, 2023
1 parent ad4de35 commit e21b75d
Show file tree
Hide file tree
Showing 11 changed files with 211 additions and 1 deletion.
20 changes: 20 additions & 0 deletions completers/go-tool-dist_completer/cmd/banner.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var bannerCmd = &cobra.Command{
Use: "banner",
Short: "print installation banner",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(bannerCmd).Standalone()

bannerCmd.Flags().BoolS("v", "v", false, "verbosity")

rootCmd.AddCommand(bannerCmd)
}
23 changes: 23 additions & 0 deletions completers/go-tool-dist_completer/cmd/bootstrap.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var bootstrapCmd = &cobra.Command{
Use: "bootstrap",
Short: "rebuild everything",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(bootstrapCmd).Standalone()

bootstrapCmd.Flags().BoolS("a", "a", false, "rebuild all")
bootstrapCmd.Flags().BoolS("d", "d", false, "enable debugging of bootstrap process")
bootstrapCmd.Flags().BoolS("no-banner", "no-banner", false, "do not print banner")
bootstrapCmd.Flags().BoolS("no-clean", "no-clean", false, "print deprecation warning")
bootstrapCmd.Flags().BoolS("v", "v", false, "verbosity")
rootCmd.AddCommand(bootstrapCmd)
}
20 changes: 20 additions & 0 deletions completers/go-tool-dist_completer/cmd/clean.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var cleanCmd = &cobra.Command{
Use: "clean",
Short: "deletes all built files",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(cleanCmd).Standalone()

cleanCmd.Flags().BoolS("v", "v", false, "verbosity")

rootCmd.AddCommand(cleanCmd)
}
23 changes: 23 additions & 0 deletions completers/go-tool-dist_completer/cmd/env.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var envCmd = &cobra.Command{
Use: "env",
Short: "print environment",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(envCmd).Standalone()

envCmd.Flags().BoolS("9", "9", false, "emit plan 9 syntax")
envCmd.Flags().BoolS("p", "p", false, "emit updated $PATH")
envCmd.Flags().BoolS("v", "v", false, "verbosity")
envCmd.Flags().BoolS("w", "w", false, "emit windows syntax")

rootCmd.AddCommand(envCmd)
}
23 changes: 23 additions & 0 deletions completers/go-tool-dist_completer/cmd/install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var installCmd = &cobra.Command{
Use: "install",
Short: "install individual directory",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(installCmd).Standalone()

installCmd.Flags().BoolS("v", "v", false, "verbosity")
rootCmd.AddCommand(installCmd)

carapace.Gen(installCmd).PositionalCompletion(
carapace.ActionDirectories(),
)
}
21 changes: 21 additions & 0 deletions completers/go-tool-dist_completer/cmd/list.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var listCmd = &cobra.Command{
Use: "list",
Short: "list all supported platforms",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(listCmd).Standalone()

listCmd.Flags().BoolS("json", "json", false, "produce JSON output")
listCmd.Flags().BoolS("v", "v", false, "verbosity")

rootCmd.AddCommand(listCmd)
}
20 changes: 20 additions & 0 deletions completers/go-tool-dist_completer/cmd/root.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var rootCmd = &cobra.Command{
Use: "go-tool-dist",
Short: "Dist helps bootstrap, build, and test the Go distribution",
Run: func(cmd *cobra.Command, args []string) {},
}

func Execute() error {
return rootCmd.Execute()
}
func init() {
carapace.Gen(rootCmd).Standalone()

}
34 changes: 34 additions & 0 deletions completers/go-tool-dist_completer/cmd/test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/rsteube/carapace-bin/pkg/actions/tools/golang"
"github.com/spf13/cobra"
)

var testCmd = &cobra.Command{
Use: "test",
Short: "run Go test(s)",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(testCmd).Standalone()

testCmd.Flags().BoolS("asan", "asan", false, "run in address sanitizer builder mode")
testCmd.Flags().StringS("banner", "banner", "", "banner prefix")
testCmd.Flags().BoolS("compile-only", "compile-only", false, "compile tests, but don't run them")
testCmd.Flags().BoolS("k", "k", false, "keep going even when error occurred")
testCmd.Flags().BoolS("list", "list", false, "list available tests")
testCmd.Flags().BoolS("msan", "msan", false, "run in memory sanitizer builder mode")
testCmd.Flags().BoolS("no-rebuild", "no-rebuild", false, "overrides -rebuild (historical dreg)")
testCmd.Flags().BoolS("race", "race", false, "run in race builder mode (different set of tests)")
testCmd.Flags().BoolS("rebuild", "rebuild", false, "rebuild everything first")
testCmd.Flags().StringS("run", "run", "", "run only those tests matching the regular expression")
testCmd.Flags().BoolS("v", "v", false, "verbosity")
rootCmd.AddCommand(testCmd)

carapace.Gen(testCmd).FlagCompletion(carapace.ActionMap{
"run": golang.ActionTests(golang.TestOpts{}.Default()),
})
}
18 changes: 18 additions & 0 deletions completers/go-tool-dist_completer/cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package cmd

import (
"github.com/rsteube/carapace"
"github.com/spf13/cobra"
)

var versionCmd = &cobra.Command{
Use: "version",
Short: "print Go version",
Run: func(cmd *cobra.Command, args []string) {},
}

func init() {
carapace.Gen(versionCmd).Standalone()

rootCmd.AddCommand(versionCmd)
}
7 changes: 7 additions & 0 deletions completers/go-tool-dist_completer/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package main

import "github.com/rsteube/carapace-bin/completers/go-tool-dist_completer/cmd"

func main() {
cmd.Execute()
}
3 changes: 2 additions & 1 deletion pkg/actions/tools/golang/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ type TestOpts struct {
Test bool
}

func (o *TestOpts) Default() {
func (o TestOpts) Default() TestOpts {
o.Benchmark = true
o.Example = true
o.Test = true
return o
}

// ActionTests completes tests
Expand Down

0 comments on commit e21b75d

Please sign in to comment.