Skip to content

Commit

Permalink
Move from Cobra to Muesli, until Cobra gets spf13/cobra#1604 done.
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickdappollonio committed Feb 18, 2022
1 parent 61aaab9 commit 82f4553
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 790 deletions.
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
)

0 comments on commit 82f4553

Please sign in to comment.