-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #104: import github.com/spf13/cobra
- Loading branch information
Showing
442 changed files
with
58,608 additions
and
42,711 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 |
---|---|---|
@@ -1,15 +1,28 @@ | ||
[[constraint]] | ||
name = "github.com/briandowns/spinner" | ||
version = "^1.0.0" | ||
|
||
[[constraint]] | ||
name = "github.com/fatih/color" | ||
version = "^1.5.0" | ||
|
||
[[constraint]] | ||
name = "github.com/kamilsk/go-kit" | ||
branch = "master" | ||
|
||
[[override]] | ||
name = "github.com/pkg/errors" | ||
version = "^0.8.0" | ||
|
||
[[constraint]] | ||
name = "github.com/spf13/cobra" | ||
version = "^0.0.3" | ||
|
||
[[constraint]] | ||
name = "github.com/stretchr/testify" | ||
version = "^1.1.4" | ||
|
||
[[constraint]] | ||
name = "github.com/briandowns/spinner" | ||
version = "1.0.0" | ||
[prune] | ||
go-tests = true | ||
non-go = true | ||
unused-packages = true |
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 go1.10 | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/kamilsk/go-kit/pkg/fn" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
const ( | ||
bashFormat = "bash" | ||
zshFormat = "zsh" | ||
) | ||
|
||
// Completion prints Bash or Zsh completion. | ||
var Completion = &cobra.Command{ | ||
Use: "completion", | ||
Short: "Print Bash or Zsh completion", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
root := cmd | ||
for { | ||
if !root.HasParent() { | ||
break | ||
} | ||
root = root.Parent() | ||
} | ||
if cmd.Flag("format").Value.String() == bashFormat { | ||
return root.GenBashCompletion(cmd.OutOrStdout()) | ||
} | ||
return root.GenZshCompletion(cmd.OutOrStdout()) | ||
}, | ||
} | ||
|
||
func init() { | ||
Completion.Flags().StringVarP(new(string), "format", "f", zshFormat, "output format, one of: bash|zsh") | ||
fn.Must(func() error { return Completion.MarkFlagRequired("format") }) | ||
} |
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,34 @@ | ||
// +build go1.10 | ||
|
||
package main | ||
|
||
import ( | ||
"bytes" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestCompletion(t *testing.T) { | ||
before := Completion.OutOrStdout() | ||
defer Completion.SetOutput(before) | ||
|
||
tests := []struct { | ||
name string | ||
format string | ||
expected string | ||
}{ | ||
{"Bash", "bash", "# bash completion for completion"}, | ||
{"Zsh", "zsh", "#compdef completion"}, | ||
} | ||
for _, test := range tests { | ||
tc := test | ||
t.Run(test.name, func(t *testing.T) { | ||
buf := bytes.NewBuffer(nil) | ||
Completion.SetOutput(buf) | ||
Completion.Flag("format").Value.Set(tc.format) | ||
assert.NoError(t, Completion.RunE(Completion, nil)) | ||
assert.Contains(t, buf.String(), tc.expected) | ||
}) | ||
} | ||
} |
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
29 changes: 0 additions & 29 deletions
29
cmd/retry/vendor/github.com/briandowns/spinner/.gitignore
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
cmd/retry/vendor/github.com/briandowns/spinner/.travis.yml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.