-
-
Notifications
You must be signed in to change notification settings - Fork 53
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
2 changed files
with
72 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,65 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "go-tool-asm", | ||
Short: "go assembler", | ||
Long: "https://pkg.go.dev/cmd/asm", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func Execute() error { | ||
return rootCmd.Execute() | ||
} | ||
func init() { | ||
carapace.Gen(rootCmd).Standalone() | ||
|
||
rootCmd.Flags().StringSliceS("D", "D", []string{}, "predefined symbol with optional simple value -D=identifier=value") | ||
rootCmd.Flags().StringSliceS("I", "I", []string{}, "include directory") | ||
rootCmd.Flags().BoolS("compiling-runtime", "compiling-runtime", false, "source to be compiled is part of the Go runtime") | ||
rootCmd.Flags().StringS("d", "d", "", "enable debugging settings") | ||
rootCmd.Flags().BoolS("debug", "debug", false, "dump instructions as they are parsed") | ||
rootCmd.Flags().BoolS("dynlink", "dynlink", false, "support references to Go symbols defined in other shared libraries") | ||
rootCmd.Flags().BoolS("gensymabis", "gensymabis", false, "write symbol ABI information to output file, don't assemble") | ||
rootCmd.Flags().BoolS("linkshared", "linkshared", false, "generate code that will be linked against Go shared libraries") | ||
rootCmd.Flags().StringS("o", "o", "", "output file") | ||
rootCmd.Flags().StringS("p", "p", "", "set expected package import to path") | ||
rootCmd.Flags().BoolS("shared", "shared", false, "generate code that can be linked into a shared library") | ||
rootCmd.Flags().StringS("spectre", "spectre", "", "enable spectre mitigations in list") | ||
rootCmd.Flags().StringS("trimpath", "trimpath", "", "remove prefix from recorded source file paths") | ||
|
||
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{ | ||
"I": carapace.ActionDirectories(), | ||
"d": carapace.ActionMultiParts(",", func(c carapace.Context) carapace.Action { | ||
return carapace.ActionMultiParts("=", func(c carapace.Context) carapace.Action { | ||
switch len(c.Parts) { | ||
case 0: | ||
return carapace.ActionValuesDescribed( | ||
"maymorestack", ",call named function before all stack growth checks", | ||
"pctab", "print named pc-value table", | ||
).Suffix("=") | ||
|
||
case 1: | ||
switch c.Parts[0] { | ||
case "pctab": | ||
return carapace.ActionValues("pctospadj", "pctofile", "pctoline", "pctoinline", "pctopcdata").NoSpace() | ||
default: | ||
return carapace.ActionValues() | ||
} | ||
|
||
default: | ||
return carapace.ActionValues() | ||
} | ||
}) | ||
}), | ||
"o": carapace.ActionFiles(), | ||
}) | ||
|
||
carapace.Gen(rootCmd).PositionalAnyCompletion( | ||
carapace.ActionFiles(), | ||
) | ||
} |
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/go-tool-asm_completer/cmd" | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |