-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
127 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/rsteube/carapace-bin/pkg/actions/tools/golang" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "capslock", | ||
Short: "Capslock is a capability analysis CLI for Go packages ", | ||
Long: "https://github.com/google/capslock", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func Execute() error { | ||
return rootCmd.Execute() | ||
} | ||
func init() { | ||
carapace.Gen(rootCmd).Standalone() | ||
|
||
rootCmd.Flags().StringS("buildtags", "buildtags", "", "command-separated list of build tags to use when loading packages") | ||
rootCmd.Flags().StringS("goarch", "goarch", "", "GOARCH value to use when loading packages") | ||
rootCmd.Flags().StringS("goos", "goos", "", "GOOS value to use when loading packages") | ||
rootCmd.Flags().BoolS("noisy", "noisy", false, "include output on unanalyzed function calls") | ||
rootCmd.Flags().StringS("output", "output", "", "output mode to use") | ||
rootCmd.Flags().StringS("packages", "packages", "", "target patterns to be analysed") | ||
|
||
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{ | ||
"buildtags": golang.ActionBuildTags(), | ||
"goarch": golang.ActionArchitectures(), | ||
"goos": golang.ActionOperatingSystems(), | ||
"output": carapace.ActionValues("json", "m", "v", "graph", "compare"), | ||
"packages": golang.ActionPackages(), | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package main | ||
|
||
import "github.com/rsteube/carapace-bin/completers/capslock_completer/cmd" | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
package golang | ||
|
||
import "github.com/rsteube/carapace" | ||
|
||
// ActionOperatingSystems completes known operating systems | ||
// | ||
// aix | ||
// android | ||
func ActionOperatingSystems() carapace.Action { | ||
return carapace.ActionValues( | ||
"aix", | ||
"android", | ||
"darwin", | ||
"dragonfly", | ||
"freebsd", | ||
"hurd", | ||
"illumos", | ||
"ios", | ||
"js", | ||
"linux", | ||
"nacl", | ||
"netbsd", | ||
"openbsd", | ||
"plan9", | ||
"solaris", | ||
"wasip1", | ||
"windows", | ||
"zos", | ||
) | ||
} | ||
|
||
// ActionUnixOperatingSystems completes known operating systems matched by the "unix" build tag | ||
// | ||
// darwin | ||
// linux | ||
func ActionUnixOperatingSystems() carapace.Action { | ||
return carapace.ActionValues( | ||
"aix", | ||
"android", | ||
"darwin", | ||
"dragonfly", | ||
"freebsd", | ||
"hurd", | ||
"illumos", | ||
"ios", | ||
"linux", | ||
"netbsd", | ||
"openbsd", | ||
"solaris", | ||
) | ||
} | ||
|
||
// ActionArchitectures completes known architectures | ||
// | ||
// 386 | ||
// amd64 | ||
func ActionArchitectures() carapace.Action { | ||
return carapace.ActionValues( | ||
"386", | ||
"amd64", | ||
"amd64p32", | ||
"arm", | ||
"armbe", | ||
"arm64", | ||
"arm64be", | ||
"loong64", | ||
"mips", | ||
"mipsle", | ||
"mips64", | ||
"mips64le", | ||
"mips64p32", | ||
"mips64p32le", | ||
"ppc", | ||
"ppc64", | ||
"ppc64le", | ||
"riscv", | ||
"riscv64", | ||
"s390", | ||
"s390x", | ||
"sparc", | ||
"sparc64", | ||
"wasm", | ||
) | ||
} |