From 90a1b5dc2396b63aafb88b5fc7de5742aaea1bbe Mon Sep 17 00:00:00 2001 From: "Lixia (Sylvia) Lei" Date: Wed, 22 Jan 2025 16:26:13 +0800 Subject: [PATCH 1/3] use lowercase letters in help docs Signed-off-by: Lixia (Sylvia) Lei --- cmd/oras/internal/option/target.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/oras/internal/option/target.go b/cmd/oras/internal/option/target.go index 4c832bb25..7fd795ead 100644 --- a/cmd/oras/internal/option/target.go +++ b/cmd/oras/internal/option/target.go @@ -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. From e7321745da5405acce883464c54755c87cac8a59 Mon Sep 17 00:00:00 2001 From: "Lixia (Sylvia) Lei" Date: Wed, 22 Jan 2025 16:29:56 +0800 Subject: [PATCH 2/3] update other places Signed-off-by: Lixia (Sylvia) Lei --- cmd/oras/internal/option/format.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/oras/internal/option/format.go b/cmd/oras/internal/option/format.go index 76acdc105..75a496342 100644 --- a/cmd/oras/internal/option/format.go +++ b/cmd/oras/internal/option/format.go @@ -86,7 +86,7 @@ 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) @@ -94,7 +94,7 @@ func (opts *Format) ApplyFlags(fs *pflag.FlagSet) { _ = 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. From c27a8aaf48c5c1fd8ea5c7f3b87f7a4efbeb09b2 Mon Sep 17 00:00:00 2001 From: "Lixia (Sylvia) Lei" Date: Wed, 22 Jan 2025 17:15:34 +0800 Subject: [PATCH 3/3] add e2e Signed-off-by: Lixia (Sylvia) Lei --- test/e2e/suite/command/cp.go | 4 +++- test/e2e/suite/command/pull.go | 1 + test/e2e/suite/command/push.go | 1 + 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/e2e/suite/command/cp.go b/test/e2e/suite/command/cp.go index 169629c2a..90dd8f40b 100644 --- a/test/e2e/suite/command/cp.go +++ b/test/e2e/suite/command/cp.go @@ -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() { diff --git a/test/e2e/suite/command/pull.go b/test/e2e/suite/command/pull.go index f31436e7a..8a22177ea 100644 --- a/test/e2e/suite/command/pull.go +++ b/test/e2e/suite/command/pull.go @@ -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() { diff --git a/test/e2e/suite/command/push.go b/test/e2e/suite/command/push.go index e489283f9..b322a2055 100644 --- a/test/e2e/suite/command/push.go +++ b/test/e2e/suite/command/push.go @@ -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() {