-
-
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.
Merge pull request #144 from rsteube/add-gofmt
added gofmt
- Loading branch information
Showing
3 changed files
with
44 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
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,33 @@ | ||
package cmd | ||
|
||
import ( | ||
"github.com/rsteube/carapace" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var rootCmd = &cobra.Command{ | ||
Use: "gofmt", | ||
Short: "", | ||
Run: func(cmd *cobra.Command, args []string) {}, | ||
} | ||
|
||
func Execute() error { | ||
return rootCmd.Execute() | ||
} | ||
func init() { | ||
carapace.Gen(rootCmd).Standalone() | ||
|
||
rootCmd.Flags().BoolS("w", "w", false, "write result to (source) file instead of stdout") | ||
rootCmd.Flags().BoolS("d", "d", false, "display diffs instead of rewriting files") | ||
rootCmd.Flags().BoolS("e", "e", false, "report all errors (not just the first 10 on different lines)") | ||
rootCmd.Flags().BoolS("l", "l", false, "list files whose formatting differs from gofmt's") | ||
rootCmd.Flags().StringS("r", "r", "", "rewrite rule") | ||
rootCmd.Flags().BoolS("s", "s", false, "simplify code") | ||
rootCmd.Flags().String("cpuprofile", "", "write cpu profile to this file") | ||
|
||
carapace.Gen(rootCmd).FlagCompletion(carapace.ActionMap{ | ||
"cpuprofile": 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/gofmt_completer/cmd" | ||
|
||
func main() { | ||
cmd.Execute() | ||
} |