-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into improve-help
- Loading branch information
Showing
14 changed files
with
188 additions
and
61 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
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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,61 @@ | ||
package completion | ||
|
||
import ( | ||
"os" | ||
|
||
"github.com/kubicorn/kubicorn/pkg/logger" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// Command will create the `completion` commands | ||
func Command(rootCmd *cobra.Command) *cobra.Command { | ||
var bashCompletionCmd = &cobra.Command{ | ||
Use: "bash", | ||
Short: "Generates bash completion scripts", | ||
Long: `To load completion run | ||
. <(eksctl completion bash) | ||
To configure your bash shell to load completions for each session add to your bashrc | ||
# ~/.bashrc or ~/.profile | ||
. <(eksctl completion bash) | ||
`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
rootCmd.GenBashCompletion(os.Stdout) | ||
}, | ||
} | ||
var zshCompletionCmd = &cobra.Command{ | ||
Use: "zsh", | ||
Short: "Generates zsh completion scripts", | ||
Long: `To configure your zsh shell, run: | ||
mkdir -p ~/.zsh/completion/ | ||
eksctl completion zsh > ~/.zsh/completion/_eksctl | ||
and put the following in ~/.zshrc: | ||
fpath=($fpath ~/.zsh/completion) | ||
`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
rootCmd.GenZshCompletion(os.Stdout) | ||
}, | ||
} | ||
|
||
cmd := &cobra.Command{ | ||
Use: "completion", | ||
Short: "Generates shell completion scripts", | ||
Run: func(c *cobra.Command, _ []string) { | ||
if err := c.Help(); err != nil { | ||
logger.Debug("ignoring error %q", err.Error()) | ||
} | ||
}, | ||
} | ||
|
||
cmd.AddCommand(bashCompletionCmd) | ||
cmd.AddCommand(zshCompletionCmd) | ||
|
||
return cmd | ||
} |
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,7 @@ | ||
// +build !release | ||
|
||
package version | ||
|
||
var ( | ||
builtAt, gitCommit, gitTag string | ||
) |
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,10 @@ | ||
// +build release | ||
|
||
package version | ||
|
||
// This file was generated by release_generate.go; DO NOT EDIT. | ||
|
||
// Values of builtAt and gitCommit will be set by the linker. | ||
var builtAt = "" | ||
var gitCommit = "" | ||
var gitTag = "0.1.11" |
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,37 @@ | ||
// +build ignore | ||
|
||
package main | ||
|
||
import ( | ||
"bytes" | ||
"io/ioutil" | ||
"log" | ||
"os" | ||
|
||
. "github.com/dave/jennifer/jen" | ||
) | ||
|
||
func main() { | ||
f := NewFile("version") | ||
|
||
f.Comment("This file was generated by release_generate.go; DO NOT EDIT.") | ||
f.Line() | ||
|
||
f.Comment("Values of builtAt and gitCommit will be set by the linker.") | ||
f.Var().Id("builtAt").Op("=").Lit("") | ||
f.Var().Id("gitCommit").Op("=").Lit("") | ||
|
||
gitTag := os.Getenv("RELEASE_GIT_TAG") | ||
f.Var().Id("gitTag").Op("=").Lit(gitTag) | ||
|
||
buf := &bytes.Buffer{} | ||
if _, err := buf.WriteString("// +build release\n\n"); err != nil { | ||
log.Fatal(err.Error()) | ||
} | ||
if err := f.Render(buf); err != nil { | ||
log.Fatal(err.Error()) | ||
} | ||
if err := ioutil.WriteFile("release.go", buf.Bytes(), 0644); err != nil { | ||
log.Fatal(err.Error()) | ||
} | ||
} |
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,31 @@ | ||
package version | ||
|
||
import ( | ||
"encoding/json" | ||
) | ||
|
||
//go:generate go run ./release_generate.go | ||
|
||
// Info hold version information | ||
type Info struct { | ||
BuiltAt string | ||
GitCommit string `json:",omitempty"` | ||
GitTag string `json:",omitempty"` | ||
} | ||
|
||
var info = Info{ | ||
BuiltAt: builtAt, | ||
GitCommit: gitCommit, | ||
GitTag: gitTag, | ||
} | ||
|
||
// Get return version Info struct | ||
func Get() Info { return info } | ||
|
||
// String return version info as JSON | ||
func String() string { | ||
if data, err := json.Marshal(info); err == nil { | ||
return string(data) | ||
} | ||
return "" | ||
} |