Skip to content

Commit

Permalink
Merge pull request #853 from CircleCI-Public/style/DEVEX-647/add-sent…
Browse files Browse the repository at this point in the history
…ence-to-inform-about-private-orbs

style: Added text informing your orb is not private
  • Loading branch information
JulesFaucherre authored Mar 3, 2023
2 parents 1c116d3 + 137b0bc commit c899e41
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
16 changes: 10 additions & 6 deletions cmd/orb.go
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,16 @@ If you change your mind about the name, you will have to create a new orb with t
`, namespace, orbName)
}

if opts.private {
fmt.Printf(`This orb will not be listed on the registry and is usable only by org users.
`)
} else {
fmt.Printf(`Please note that any versions you publish of this orb will be world readable unless you create it with the '--private' flag
`)
}

confirm := fmt.Sprintf("Are you sure you wish to create the orb: `%s/%s`", namespace, orbName)

if opts.noPrompt || opts.tty.askUserToConfirm(confirm) {
Expand All @@ -880,13 +890,7 @@ If you change your mind about the name, you will have to create a new orb with t
return err
}

confirmationString := "Please note that any versions you publish of this orb are world-readable."
if opts.private {
confirmationString = "This orb will not be listed on the registry and is usable only by org users."
}

fmt.Printf("Orb `%s` created.\n", opts.args[0])
fmt.Println(confirmationString)
fmt.Printf("You can now register versions of `%s` using `circleci orb publish`.\n", opts.args[0])
}

Expand Down
13 changes: 8 additions & 5 deletions cmd/orb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,9 @@ See a full explanation and documentation on orbs here: https://circleci.com/docs
Eventually(session).Should(gexec.Exit(0))

stdout := session.Wait().Out.Contents()
Expect(string(stdout)).To(ContainSubstring(fmt.Sprintf(`Orb %s created.
Please note that any versions you publish of this orb are world-readable.
Expect(string(stdout)).To(ContainSubstring(fmt.Sprintf(`Please note that any versions you publish of this orb will be world readable unless you create it with the '--private' flag
Orb %s created.
You can now register versions of %s using %s`, "`bar-ns/foo-orb`", "`bar-ns/foo-orb`", "`circleci orb publish`")))
})

Expand Down Expand Up @@ -1232,8 +1233,9 @@ You can now register versions of %s using %s`, "`bar-ns/foo-orb`", "`bar-ns/foo-
Eventually(session).Should(gexec.Exit(0))

stdout := session.Wait().Out.Contents()
Expect(string(stdout)).To(ContainSubstring(fmt.Sprintf(`Orb %s created.
This orb will not be listed on the registry and is usable only by org users.
Expect(string(stdout)).To(ContainSubstring(fmt.Sprintf(`This orb will not be listed on the registry and is usable only by org users.
Orb %s created.
You can now register versions of %s using %s`, "`bar-ns/foo-orb`", "`bar-ns/foo-orb`", "`circleci orb publish`")))
})

Expand Down Expand Up @@ -1365,9 +1367,10 @@ You will not be able to change the name of this orb.
If you change your mind about the name, you will have to create a new orb with the new name.
Please note that any versions you publish of this orb will be world readable unless you create it with the '--private' flag
Are you sure you wish to create the orb: %s
Orb %s created.
Please note that any versions you publish of this orb are world-readable.
You can now register versions of %s using %s.`,
"bar-ns/foo-orb", "`bar-ns/foo-orb`", "`bar-ns/foo-orb`", "`bar-ns/foo-orb`", "`circleci orb publish`")))
})
Expand Down

0 comments on commit c899e41

Please sign in to comment.