Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update the help doc for --oci-layout-path #1609

Merged
merged 3 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/oras/internal/option/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ func (f *Format) SetTypes(defaultType *FormatType, otherTypes ...*FormatType) {

// ApplyFlags implements FlagProvider.ApplyFlag.
func (opts *Format) ApplyFlags(fs *pflag.FlagSet) {
buf := bytes.NewBufferString("[Experimental] Format output using a custom template:")
buf := bytes.NewBufferString("[Experimental] format output using a custom template:")
w := tabwriter.NewWriter(buf, 0, 0, 2, ' ', 0)
for _, t := range opts.allowedTypes {
_, _ = fmt.Fprintf(w, "\n'%s':\t%s", t.Name, t.Usage)
}
_ = w.Flush()
// apply flags
fs.StringVar(&opts.FormatFlag, "format", opts.FormatFlag, buf.String())
fs.StringVar(&opts.Template, "template", "", "[Experimental] Template string used to format output")
fs.StringVar(&opts.Template, "template", "", "[Experimental] template string used to format output")
}

// Parse parses the input format flag.
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/internal/option/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (opts *Target) AnnotatedReference() string {
func (opts *Target) applyFlagsWithPrefix(fs *pflag.FlagSet, prefix, description string) {
flagPrefix, notePrefix := applyPrefix(prefix, description)
fs.BoolVarP(&opts.IsOCILayout, flagPrefix+"oci-layout", "", false, "set "+notePrefix+"target as an OCI image layout")
fs.StringVar(&opts.Path, flagPrefix+"oci-layout-path", "", "[Experimental] Set the path for the "+notePrefix+"OCI image layout target")
fs.StringVar(&opts.Path, flagPrefix+"oci-layout-path", "", "[Experimental] set the path for the "+notePrefix+"OCI image layout target")
}

// ApplyFlagsWithPrefix applies flags to a command flag set with a prefix string.
Expand Down
4 changes: 3 additions & 1 deletion test/e2e/suite/command/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ func cpTestRepo(text string) string {
var _ = Describe("ORAS beginners:", func() {
When("running cp command", func() {
It("should show help doc with feature flags", func() {
out := ORAS("cp", "--help").MatchKeyWords("Copy", ExampleDesc).Exec()
out := ORAS("cp", "--help").MatchKeyWords("Copy", ExampleDesc).Exec().Out
Expect(out).Should(gbytes.Say("--from-distribution-spec string\\s+%s", regexp.QuoteMeta(feature.Preview.Mark)))
Expect(out).Should(gbytes.Say("--from-oci-layout-path string\\s+%s", regexp.QuoteMeta(feature.Experimental.Mark)))
Expect(out).Should(gbytes.Say("-r, --recursive\\s+%s", regexp.QuoteMeta(feature.Preview.Mark)))
Expect(out).Should(gbytes.Say("--to-distribution-spec string\\s+%s", regexp.QuoteMeta(feature.Preview.Mark)))
Expect(out).Should(gbytes.Say("--to-oci-layout-path string\\s+%s", regexp.QuoteMeta(feature.Experimental.Mark)))
})

It("should not show --verbose in help doc", func() {
Expand Down
1 change: 1 addition & 0 deletions test/e2e/suite/command/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ var _ = Describe("ORAS beginners:", func() {
It("should show help description with feature flags", func() {
out := ORAS("pull", "--help").MatchKeyWords(ExampleDesc).Exec().Out
gomega.Expect(out).Should(gbytes.Say("--include-subject\\s+%s", regexp.QuoteMeta(feature.Preview.Mark)))
gomega.Expect(out).Should(gbytes.Say("--oci-layout-path string\\s+%s", regexp.QuoteMeta(feature.Experimental.Mark)))
})

It("should not show --verbose in help doc", func() {
Expand Down
1 change: 1 addition & 0 deletions test/e2e/suite/command/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ var _ = Describe("ORAS beginners:", func() {
It("should show help description with feature flags", func() {
out := ORAS("push", "--help").MatchKeyWords(ExampleDesc).Exec().Out
gomega.Expect(out).Should(gbytes.Say("--image-spec string\\s+%s", regexp.QuoteMeta(feature.Preview.Mark)))
gomega.Expect(out).Should(gbytes.Say("--oci-layout-path string\\s+%s", regexp.QuoteMeta(feature.Experimental.Mark)))
})

It("should not show --verbose in help doc", func() {
Expand Down
Loading