Skip to content

Commit

Permalink
Make --org-name and --vcs positional arguments on orb ns create
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Scott committed Jul 31, 2018
1 parent 844a4cf commit 57ad820
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
15 changes: 5 additions & 10 deletions cmd/orb.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ import (

var orbVersion string
var orbID string
var organizationName string
var organizationVcs string

func newOrbCommand() *cobra.Command {

Expand Down Expand Up @@ -74,17 +72,14 @@ func newOrbCommand() *cobra.Command {
}

createNamespace := &cobra.Command{
Use: "create <name>",
Use: "create [name] [vcs] [org-name]",
Short: "create an orb namespace",
RunE: createOrbNamespace,
Args: cobra.ExactArgs(1),
Args: cobra.ExactArgs(3),
}

createNamespace.PersistentFlags().StringVar(&organizationName, "org-name", "", "organization name (required)")
if err := createNamespace.MarkPersistentFlagRequired("org-name"); err != nil {
panic(err)
}
createNamespace.PersistentFlags().StringVar(&organizationVcs, "vcs", "github", "organization vcs, e.g. 'github', 'bitbucket'")
// "org-name", "", "organization name (required)"
// "vcs", "github", "organization vcs, e.g. 'github', 'bitbucket'"

namespaceCommand := &cobra.Command{
Use: "namespace",
Expand Down Expand Up @@ -343,7 +338,7 @@ func createOrbNamespace(cmd *cobra.Command, args []string) error {
var err error
ctx := context.Background()

response, err := api.CreateNamespace(ctx, Logger, args[0], organizationName, strings.ToUpper(organizationVcs))
response, err := api.CreateNamespace(ctx, Logger, args[0], args[2], strings.ToUpper(args[1]))

if err != nil {
return err
Expand Down
8 changes: 4 additions & 4 deletions cmd/orb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,8 @@ var _ = Describe("Orb integration tests", func() {
"-t", token,
"-e", testServer.URL(),
"foo-ns",
"--org-name", "test-org",
"--vcs", "BITBUCKET",
"BITBUCKET",
"test-org",
)
})

Expand Down Expand Up @@ -492,8 +492,8 @@ var _ = Describe("Orb integration tests", func() {
"-t", token,
"-e", testServer.URL(),
"foo-ns",
"--org-name", "test-org",
"--vcs", "BITBUCKET",
"BITBUCKET",
"test-org",
)
})

Expand Down

0 comments on commit 57ad820

Please sign in to comment.