Merge tag '0.0.5' into develop

Release 0.0.5
This commit is contained in:
Brian Meyers 2019-02-22 14:20:44 -05:00
commit b549b4ca19
27 changed files with 68 additions and 55 deletions

View file

@ -2,7 +2,7 @@ version: 2
references: references:
workspace: &workspace workspace: &workspace
/go/src/github.com/OneCloudInc/cobra /go/src/github.com/spf13/cobra
run_tests: &run_tests run_tests: &run_tests
run: run:

13
Gopkg.lock generated
View file

@ -103,6 +103,17 @@
revision = "8c9545af88b134710ab1cd196795e7f2388358d7" revision = "8c9545af88b134710ab1cd196795e7f2388358d7"
version = "v1.3.0" version = "v1.3.0"
[[projects]]
digest = "1:e01b05ba901239c783dfe56450bcde607fc858908529868259c9a8765dc176d0"
name = "github.com/spf13/cobra"
packages = [
".",
"doc",
]
pruneopts = "UT"
revision = "ef82de70bb3f60c65fb8eebacbb2d122ef517385"
version = "v0.0.3"
[[projects]] [[projects]]
digest = "1:68ea4e23713989dc20b1bded5d9da2c5f9be14ff9885beef481848edd18c26cb" digest = "1:68ea4e23713989dc20b1bded5d9da2c5f9be14ff9885beef481848edd18c26cb"
name = "github.com/spf13/jwalterweatherman" name = "github.com/spf13/jwalterweatherman"
@ -165,6 +176,8 @@
"github.com/cpuguy83/go-md2man/md2man", "github.com/cpuguy83/go-md2man/md2man",
"github.com/inconshreveable/mousetrap", "github.com/inconshreveable/mousetrap",
"github.com/mitchellh/go-homedir", "github.com/mitchellh/go-homedir",
"github.com/spf13/cobra",
"github.com/spf13/cobra/doc",
"github.com/spf13/pflag", "github.com/spf13/pflag",
"github.com/spf13/viper", "github.com/spf13/viper",
"gopkg.in/yaml.v2", "gopkg.in/yaml.v2",

View file

@ -24,7 +24,7 @@ Many of the most widely used Go projects are built using Cobra including:
[![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra) [![Build Status](https://travis-ci.org/spf13/cobra.svg "Travis CI status")](https://travis-ci.org/spf13/cobra)
[![CircleCI status](https://circleci.com/gh/spf13/cobra.png?circle-token=:circle-token "CircleCI status")](https://circleci.com/gh/spf13/cobra) [![CircleCI status](https://circleci.com/gh/spf13/cobra.png?circle-token=:circle-token "CircleCI status")](https://circleci.com/gh/spf13/cobra)
[![GoDoc](https://godoc.org/github.com/OneCloudInc/cobra?status.svg)](https://godoc.org/github.com/OneCloudInc/cobra) [![GoDoc](https://godoc.org/github.com/spf13/cobra?status.svg)](https://godoc.org/github.com/spf13/cobra)
# Table of Contents # Table of Contents
@ -103,7 +103,7 @@ have children commands and optionally run an action.
In the example above, 'server' is the command. In the example above, 'server' is the command.
[More about cobra.Command](https://godoc.org/github.com/OneCloudInc/cobra#Command) [More about cobra.Command](https://godoc.org/github.com/spf13/cobra#Command)
## Flags ## Flags
@ -128,7 +128,7 @@ along with the library and its dependencies:
Next, include Cobra in your application: Next, include Cobra in your application:
```go ```go
import "github.com/OneCloudInc/cobra" import "github.com/spf13/cobra"
``` ```
# Getting Started # Getting Started
@ -165,7 +165,7 @@ func main() {
Cobra provides its own program that will create your application and add any Cobra provides its own program that will create your application and add any
commands you want. It's the easiest way to incorporate Cobra into your application. commands you want. It's the easiest way to incorporate Cobra into your application.
[Here](https://github.com/OneCloudInc/cobra/blob/master/cobra/README.md) you can find more information about it. [Here](https://github.com/spf13/cobra/blob/master/cobra/README.md) you can find more information about it.
## Using the Cobra Library ## Using the Cobra Library
@ -208,7 +208,7 @@ import (
"os" "os"
homedir "github.com/mitchellh/go-homedir" homedir "github.com/mitchellh/go-homedir"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
) )
@ -284,7 +284,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func init() { func init() {
@ -430,7 +430,7 @@ import (
"fmt" "fmt"
"strings" "strings"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func main() { func main() {
@ -597,7 +597,7 @@ package main
import ( import (
"fmt" "fmt"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func main() { func main() {
@ -728,4 +728,4 @@ Cobra can generate a bash-completion file. If you add more information to your c
# License # License
Cobra is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/OneCloudInc/cobra/blob/master/LICENSE.txt) Cobra is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/spf13/cobra/blob/master/LICENSE.txt)

View file

@ -19,7 +19,7 @@ import (
"path/filepath" "path/filepath"
"unicode" "unicode"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func init() { func init() {
@ -71,7 +71,7 @@ Example: cobra add server -> resulting in a new cmd/server.go`,
// validateCmdName returns source without any dashes and underscore. // validateCmdName returns source without any dashes and underscore.
// If there will be dash or underscore, next letter will be uppered. // If there will be dash or underscore, next letter will be uppered.
// It supports only ASCII (1-byte character) strings. // It supports only ASCII (1-byte character) strings.
// https://github.com/OneCloudInc/cobra/issues/269 // https://github.com/spf13/cobra/issues/269
func validateCmdName(source string) string { func validateCmdName(source string) string {
i := 0 i := 0
l := len(source) l := len(source)
@ -130,7 +130,7 @@ package {{.cmdPackage}}
import ( import (
"fmt" "fmt"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
{{ printFlagVars .flags }} {{ printFlagVars .flags }}

View file

@ -19,7 +19,7 @@ import (
"path" "path"
"path/filepath" "path/filepath"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
) )
@ -148,7 +148,7 @@ import (
"os" "os"
{{if .viper}} {{if .viper}}
homedir "github.com/mitchellh/go-homedir"{{end}} homedir "github.com/mitchellh/go-homedir"{{end}}
"github.com/OneCloudInc/cobra"{{if .viper}} "github.com/spf13/cobra"{{if .viper}}
"github.com/spf13/viper"{{end}} "github.com/spf13/viper"{{end}}
){{if .viper}} ){{if .viper}}

View file

@ -114,7 +114,7 @@ func (p *Project) License() License {
return p.license return p.license
} }
// Name returns the name of project, e.g. "github.com/OneCloudInc/cobra" // Name returns the name of project, e.g. "github.com/spf13/cobra"
func (p Project) Name() string { func (p Project) Name() string {
return p.name return p.name
} }

View file

@ -5,7 +5,7 @@ import (
) )
func TestFindExistingPackage(t *testing.T) { func TestFindExistingPackage(t *testing.T) {
path := findPackage("github.com/OneCloudInc/cobra") path := findPackage("github.com/spf13/cobra")
if path == "" { if path == "" {
t.Fatal("findPackage didn't find the existing package") t.Fatal("findPackage didn't find the existing package")
} }

View file

@ -17,7 +17,7 @@ import (
"fmt" "fmt"
homedir "github.com/mitchellh/go-homedir" homedir "github.com/mitchellh/go-homedir"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
"github.com/spf13/viper" "github.com/spf13/viper"
) )

View file

@ -18,7 +18,7 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )

View file

@ -17,7 +17,7 @@ package cmd
import ( import (
"fmt" "fmt"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )

View file

@ -1223,7 +1223,7 @@ func (c *Command) IsAvailableCommand() bool {
// help topic command; additional help topic command is determined by the // help topic command; additional help topic command is determined by the
// fact that it is NOT runnable/hidden/deprecated, and has no sub commands that // fact that it is NOT runnable/hidden/deprecated, and has no sub commands that
// are runnable/hidden/deprecated. // are runnable/hidden/deprecated.
// Concrete example: https://github.com/OneCloudInc/cobra/issues/393#issuecomment-282741924. // Concrete example: https://github.com/spf13/cobra/issues/393#issuecomment-282741924.
func (c *Command) IsAdditionalHelpTopicCommand() bool { func (c *Command) IsAdditionalHelpTopicCommand() bool {
// if a command is runnable, deprecated, or hidden it is not a 'help' command // if a command is runnable, deprecated, or hidden it is not a 'help' command
if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden { if c.Runnable() || len(c.Deprecated) != 0 || c.Hidden {

View file

@ -805,7 +805,7 @@ func TestHelpFlagExecutedOnChild(t *testing.T) {
// TestHelpFlagInHelp checks, // TestHelpFlagInHelp checks,
// if '--help' flag is shown in help for child (executing `parent help child`), // if '--help' flag is shown in help for child (executing `parent help child`),
// that has no other flags. // that has no other flags.
// Related to https://github.com/OneCloudInc/cobra/issues/302. // Related to https://github.com/spf13/cobra/issues/302.
func TestHelpFlagInHelp(t *testing.T) { func TestHelpFlagInHelp(t *testing.T) {
parentCmd := &Command{Use: "parent", Run: func(*Command, []string) {}} parentCmd := &Command{Use: "parent", Run: func(*Command, []string) {}}
@ -1166,7 +1166,7 @@ func TestPersistentHooks(t *testing.T) {
// TODO: currently PersistenPreRun* defined in parent does not // TODO: currently PersistenPreRun* defined in parent does not
// run if the matchin child subcommand has PersistenPreRun. // run if the matchin child subcommand has PersistenPreRun.
// If the behavior changes (https://github.com/OneCloudInc/cobra/issues/252) // If the behavior changes (https://github.com/spf13/cobra/issues/252)
// this test must be fixed. // this test must be fixed.
if parentPersPreArgs != "" { if parentPersPreArgs != "" {
t.Errorf("Expected blank parentPersPreArgs, got %q", parentPersPreArgs) t.Errorf("Expected blank parentPersPreArgs, got %q", parentPersPreArgs)
@ -1182,7 +1182,7 @@ func TestPersistentHooks(t *testing.T) {
} }
// TODO: currently PersistenPostRun* defined in parent does not // TODO: currently PersistenPostRun* defined in parent does not
// run if the matchin child subcommand has PersistenPostRun. // run if the matchin child subcommand has PersistenPostRun.
// If the behavior changes (https://github.com/OneCloudInc/cobra/issues/252) // If the behavior changes (https://github.com/spf13/cobra/issues/252)
// this test must be fixed. // this test must be fixed.
if parentPersPostArgs != "" { if parentPersPostArgs != "" {
t.Errorf("Expected blank parentPersPostArgs, got %q", parentPersPostArgs) t.Errorf("Expected blank parentPersPostArgs, got %q", parentPersPostArgs)
@ -1205,7 +1205,7 @@ func TestPersistentHooks(t *testing.T) {
} }
} }
// Related to https://github.com/OneCloudInc/cobra/issues/521. // Related to https://github.com/spf13/cobra/issues/521.
func TestGlobalNormFuncPropagation(t *testing.T) { func TestGlobalNormFuncPropagation(t *testing.T) {
normFunc := func(f *pflag.FlagSet, name string) pflag.NormalizedName { normFunc := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
return pflag.NormalizedName(name) return pflag.NormalizedName(name)
@ -1225,7 +1225,7 @@ func TestGlobalNormFuncPropagation(t *testing.T) {
} }
} }
// Related to https://github.com/OneCloudInc/cobra/issues/521. // Related to https://github.com/spf13/cobra/issues/521.
func TestNormPassedOnLocal(t *testing.T) { func TestNormPassedOnLocal(t *testing.T) {
toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName { toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
return pflag.NormalizedName(strings.ToUpper(name)) return pflag.NormalizedName(strings.ToUpper(name))
@ -1239,7 +1239,7 @@ func TestNormPassedOnLocal(t *testing.T) {
} }
} }
// Related to https://github.com/OneCloudInc/cobra/issues/521. // Related to https://github.com/spf13/cobra/issues/521.
func TestNormPassedOnInherited(t *testing.T) { func TestNormPassedOnInherited(t *testing.T) {
toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName { toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
return pflag.NormalizedName(strings.ToUpper(name)) return pflag.NormalizedName(strings.ToUpper(name))
@ -1267,7 +1267,7 @@ func TestNormPassedOnInherited(t *testing.T) {
} }
} }
// Related to https://github.com/OneCloudInc/cobra/issues/521. // Related to https://github.com/spf13/cobra/issues/521.
func TestConsistentNormalizedName(t *testing.T) { func TestConsistentNormalizedName(t *testing.T) {
toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName { toUpper := func(f *pflag.FlagSet, name string) pflag.NormalizedName {
return pflag.NormalizedName(strings.ToUpper(name)) return pflag.NormalizedName(strings.ToUpper(name))
@ -1400,7 +1400,7 @@ func TestFlagErrorFunc(t *testing.T) {
// TestSortedFlags checks, // TestSortedFlags checks,
// if cmd.LocalFlags() is unsorted when cmd.Flags().SortFlags set to false. // if cmd.LocalFlags() is unsorted when cmd.Flags().SortFlags set to false.
// Related to https://github.com/OneCloudInc/cobra/issues/404. // Related to https://github.com/spf13/cobra/issues/404.
func TestSortedFlags(t *testing.T) { func TestSortedFlags(t *testing.T) {
c := &Command{} c := &Command{}
c.Flags().SortFlags = false c.Flags().SortFlags = false
@ -1426,7 +1426,7 @@ func TestSortedFlags(t *testing.T) {
// TestMergeCommandLineToFlags checks, // TestMergeCommandLineToFlags checks,
// if pflag.CommandLine is correctly merged to c.Flags() after first call // if pflag.CommandLine is correctly merged to c.Flags() after first call
// of c.mergePersistentFlags. // of c.mergePersistentFlags.
// Related to https://github.com/OneCloudInc/cobra/issues/443. // Related to https://github.com/spf13/cobra/issues/443.
func TestMergeCommandLineToFlags(t *testing.T) { func TestMergeCommandLineToFlags(t *testing.T) {
pflag.Bool("boolflag", false, "") pflag.Bool("boolflag", false, "")
c := &Command{Use: "c", Run: emptyRun} c := &Command{Use: "c", Run: emptyRun}
@ -1440,7 +1440,7 @@ func TestMergeCommandLineToFlags(t *testing.T) {
// TestUseDeprecatedFlags checks, // TestUseDeprecatedFlags checks,
// if cobra.Execute() prints a message, if a deprecated flag is used. // if cobra.Execute() prints a message, if a deprecated flag is used.
// Related to https://github.com/OneCloudInc/cobra/issues/463. // Related to https://github.com/spf13/cobra/issues/463.
func TestUseDeprecatedFlags(t *testing.T) { func TestUseDeprecatedFlags(t *testing.T) {
c := &Command{Use: "c", Run: emptyRun} c := &Command{Use: "c", Run: emptyRun}
c.Flags().BoolP("deprecated", "d", false, "deprecated flag") c.Flags().BoolP("deprecated", "d", false, "deprecated flag")
@ -1555,7 +1555,7 @@ func TestTraverseWithTwoSubcommands(t *testing.T) {
} }
// TestUpdateName checks if c.Name() updates on changed c.Use. // TestUpdateName checks if c.Name() updates on changed c.Use.
// Related to https://github.com/OneCloudInc/cobra/pull/422#discussion_r143918343. // Related to https://github.com/spf13/cobra/pull/422#discussion_r143918343.
func TestUpdateName(t *testing.T) { func TestUpdateName(t *testing.T) {
c := &Command{Use: "name xyz"} c := &Command{Use: "name xyz"}
originalName := c.Name() originalName := c.Name()

View file

@ -4,7 +4,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func emptyRun(*cobra.Command, []string) {} func emptyRun(*cobra.Command, []string) {}

View file

@ -25,7 +25,7 @@ import (
"time" "time"
"github.com/cpuguy83/go-md2man/md2man" "github.com/cpuguy83/go-md2man/md2man"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
"github.com/spf13/pflag" "github.com/spf13/pflag"
) )

View file

@ -8,8 +8,8 @@ package main
import ( import (
"log" "log"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
"github.com/OneCloudInc/cobra/doc" "github.com/spf13/cobra/doc"
) )
func main() { func main() {

View file

@ -10,7 +10,7 @@ import (
"strings" "strings"
"testing" "testing"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func translate(in string) string { func translate(in string) string {

View file

@ -4,8 +4,8 @@ import (
"bytes" "bytes"
"fmt" "fmt"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
"github.com/OneCloudInc/cobra/doc" "github.com/spf13/cobra/doc"
) )
func ExampleGenManTree() { func ExampleGenManTree() {

View file

@ -23,7 +23,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error { func printOptions(buf *bytes.Buffer, cmd *cobra.Command, name string) error {

View file

@ -8,8 +8,8 @@ package main
import ( import (
"log" "log"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
"github.com/OneCloudInc/cobra/doc" "github.com/spf13/cobra/doc"
) )
func main() { func main() {
@ -41,7 +41,7 @@ import (
"k8s.io/kubernetes/pkg/kubectl/cmd" "k8s.io/kubernetes/pkg/kubectl/cmd"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"github.com/OneCloudInc/cobra/doc" "github.com/spf13/cobra/doc"
) )
func main() { func main() {

View file

@ -7,7 +7,7 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func TestGenMdDoc(t *testing.T) { func TestGenMdDoc(t *testing.T) {

View file

@ -23,7 +23,7 @@ import (
"strings" "strings"
"time" "time"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error { func printOptionsReST(buf *bytes.Buffer, cmd *cobra.Command, name string) error {

View file

@ -8,8 +8,8 @@ package main
import ( import (
"log" "log"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
"github.com/OneCloudInc/cobra/doc" "github.com/spf13/cobra/doc"
) )
func main() { func main() {
@ -41,7 +41,7 @@ import (
"k8s.io/kubernetes/pkg/kubectl/cmd" "k8s.io/kubernetes/pkg/kubectl/cmd"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"github.com/OneCloudInc/cobra/doc" "github.com/spf13/cobra/doc"
) )
func main() { func main() {

View file

@ -7,7 +7,7 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func TestGenRSTDoc(t *testing.T) { func TestGenRSTDoc(t *testing.T) {

View file

@ -16,7 +16,7 @@ package doc
import ( import (
"strings" "strings"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
// Test to see if we have a reason to print See Also information in docs // Test to see if we have a reason to print See Also information in docs

View file

@ -21,7 +21,7 @@ import (
"sort" "sort"
"strings" "strings"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
"github.com/spf13/pflag" "github.com/spf13/pflag"
"gopkg.in/yaml.v2" "gopkg.in/yaml.v2"
) )

View file

@ -8,8 +8,8 @@ package main
import ( import (
"log" "log"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
"github.com/OneCloudInc/cobra/doc" "github.com/spf13/cobra/doc"
) )
func main() { func main() {
@ -41,7 +41,7 @@ import (
"k8s.io/kubernetes/pkg/kubectl/cmd" "k8s.io/kubernetes/pkg/kubectl/cmd"
cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
"github.com/OneCloudInc/cobra/doc" "github.com/spf13/cobra/doc"
) )
func main() { func main() {

View file

@ -7,7 +7,7 @@ import (
"path/filepath" "path/filepath"
"testing" "testing"
"github.com/OneCloudInc/cobra" "github.com/spf13/cobra"
) )
func TestGenYamlDoc(t *testing.T) { func TestGenYamlDoc(t *testing.T) {