Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move from Cobra to Muesli, until Cobra gets spf13/cobra#1604 done. #31

Merged
merged 1 commit into from Feb 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions app.go
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"os"

"github.com/muesli/coral"
"github.com/patrickdappollonio/kubectl-slice/slice"
"github.com/spf13/cobra"
)

var version = "development"
Expand Down Expand Up @@ -38,18 +38,18 @@ func generateExamples([]string) string {
return s.String()
}

func root() *cobra.Command {
func root() *coral.Command {
opts := slice.Options{}

rootCommand := &cobra.Command{
rootCommand := &coral.Command{
Use: "kubectl-slice",
Short: helpShort,
Long: helpLong,
Version: version,
SilenceUsage: true,
SilenceErrors: true,
Example: generateExamples(examples),
RunE: func(_ *cobra.Command, args []string) error {
RunE: func(_ *coral.Command, args []string) error {
// If no input file has been provided or it's "-", then
// point the app to stdin
if opts.InputFile == "" || opts.InputFile == "-" {
Expand Down
2 changes: 1 addition & 1 deletion docs/examples.md
Expand Up @@ -25,7 +25,7 @@ helm template tekton cdf/tekton-pipeline
Then we can pipe that output directly to `kubectl-slice`:

```bash
helm template tekton cdf/tekton-pipeline | kubectl-slice --template '{{.kind|lower}}/{{.metadata.name|dottodash}}.yaml'
helm template tekton cdf/tekton-pipeline | kubectl-slice --template '{{.kind|lower}}/{{.metadata.name|dottodash}}.yaml' --output-dir .
```

Which will render the following output:
Expand Down
4 changes: 3 additions & 1 deletion go.mod
Expand Up @@ -4,11 +4,13 @@ go 1.17

require (
github.com/mb0/glob v0.0.0-20160210091149-1eb79d2de6c4
github.com/spf13/cobra v1.3.0
github.com/muesli/coral v1.0.0
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b
)

require (
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/kr/pretty v0.2.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
)