Skip to content

Commit

Permalink
move verbose out of common
Browse files Browse the repository at this point in the history
Signed-off-by: Lixia (Sylvia) Lei <[email protected]>
  • Loading branch information
Wwwsylvia committed Nov 27, 2024
1 parent e376648 commit e58b7b5
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/oras/root/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ type attachOptions struct {
option.Format
option.Platform

// Verbose is deprecated. The default behavior is now equivalent to
// Verbose=true, while Verbose=false no longer takes effect.
Verbose bool
artifactType string
concurrency int
}
Expand Down Expand Up @@ -113,9 +116,12 @@ Example - Attach file to the manifest tagged 'v1' in an OCI image layout folder
},
}

opts.FlagDescription = "[Preview] attach to an arch-specific subject"
cmd.Flags().StringVarP(&opts.artifactType, "artifact-type", "", "", "artifact type")
cmd.Flags().IntVarP(&opts.concurrency, "concurrency", "", 5, "concurrency level")
opts.FlagDescription = "[Preview] attach to an arch-specific subject"
cmd.Flags().BoolVarP(&opts.Verbose, "verbose", "v", false, "[Deprecated] verbose output")

_ = cmd.Flags().MarkDeprecated("verbose", "and may be removed in a future release.")
_ = cmd.MarkFlagRequired("artifact-type")
opts.EnableDistributionSpecFlag()
opts.SetTypes(option.FormatTypeText, option.FormatTypeJSON, option.FormatTypeGoTemplate)
Expand Down
6 changes: 6 additions & 0 deletions cmd/oras/root/blob/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ type pushBlobOptions struct {
option.Pretty
option.Target

// Verbose is deprecated. The default behavior is now equivalent to
// Verbose=true, while Verbose=false no longer takes effect.
Verbose bool
fileRef string
mediaType string
size int64
Expand Down Expand Up @@ -96,6 +99,9 @@ Example - Push blob 'hi.txt' into an OCI image layout folder 'layout-dir':

cmd.Flags().Int64VarP(&opts.size, "size", "", -1, "provide the blob size")
cmd.Flags().StringVarP(&opts.mediaType, "media-type", "", ocispec.MediaTypeImageLayer, "specify the returned media type in the descriptor if --descriptor is used")
cmd.Flags().BoolVarP(&opts.Verbose, "verbose", "v", false, "[Deprecated] verbose output")
_ = cmd.Flags().MarkDeprecated("verbose", "and may be removed in a future release.")

option.ApplyFlags(&opts, cmd.Flags())
return oerrors.Command(cmd, &opts.Target)
}
Expand Down
6 changes: 6 additions & 0 deletions cmd/oras/root/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ type copyOptions struct {
option.Platform
option.BinaryTarget

// Verbose is deprecated. The default behavior is now equivalent to
// Verbose=true, while Verbose=false no longer takes effect.
Verbose bool
recursive bool
concurrency int
extraRefs []string
Expand Down Expand Up @@ -105,6 +108,9 @@ Example - Copy an artifact with multiple tags with concurrency tuned:
}
cmd.Flags().BoolVarP(&opts.recursive, "recursive", "r", false, "[Preview] recursively copy the artifact and its referrer artifacts")
cmd.Flags().IntVarP(&opts.concurrency, "concurrency", "", 3, "concurrency level")
cmd.Flags().BoolVarP(&opts.Verbose, "verbose", "v", false, "[Deprecated] verbose output")
_ = cmd.Flags().MarkDeprecated("verbose", "and may be removed in a future release.")

opts.EnableDistributionSpecFlag()
option.ApplyFlags(&opts, cmd.Flags())
return oerrors.Command(cmd, &opts.BinaryTarget)
Expand Down
2 changes: 2 additions & 0 deletions cmd/oras/root/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ type discoverOptions struct {
option.Platform
option.Target
option.Format
Verbose bool

artifactType string
}
Expand Down Expand Up @@ -101,6 +102,7 @@ Example - Discover referrers of the manifest tagged 'v1' in an OCI image layout

cmd.Flags().StringVarP(&opts.artifactType, "artifact-type", "", "", "artifact type")
cmd.Flags().StringVarP(&opts.Format.FormatFlag, "output", "o", "tree", "[Deprecated] format in which to display referrers (table, json, or tree). tree format will also show indirect referrers")
cmd.Flags().BoolVarP(&opts.Verbose, "verbose", "v", false, "display full metadata of referrers")
opts.SetTypes(
option.FormatTypeTree,
option.FormatTypeTable,
Expand Down
6 changes: 6 additions & 0 deletions cmd/oras/root/manifest/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ type pushOptions struct {
option.Pretty
option.Target

// Verbose is deprecated. The default behavior is now equivalent to
// Verbose=true, while Verbose=false no longer takes effect.
Verbose bool
concurrency int
extraRefs []string
fileRef string
Expand Down Expand Up @@ -107,6 +110,9 @@ Example - Push a manifest to an OCI image layout folder 'layout-dir' and tag wit
option.ApplyFlags(&opts, cmd.Flags())
cmd.Flags().StringVarP(&opts.mediaType, "media-type", "", "", "media type of manifest")
cmd.Flags().IntVarP(&opts.concurrency, "concurrency", "", 5, "concurrency level")
cmd.Flags().BoolVarP(&opts.Verbose, "verbose", "v", false, "[Deprecated] verbose output")
_ = cmd.Flags().MarkDeprecated("verbose", "and may be removed in a future release.")

return oerrors.Command(cmd, &opts.Target)
}

Expand Down
6 changes: 6 additions & 0 deletions cmd/oras/root/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ type pullOptions struct {
PathTraversal bool
Output string
ManifestConfigRef string
// Verbose is deprecated. The default behavior is now equivalent to
// Verbose=true, while Verbose=false no longer takes effect.
Verbose bool
}

func pullCmd() *cobra.Command {
Expand Down Expand Up @@ -111,6 +114,9 @@ Example - Pull artifact files from an OCI layout archive 'layout.tar':
cmd.Flags().StringVarP(&opts.Output, "output", "o", ".", "output directory")
cmd.Flags().StringVarP(&opts.ManifestConfigRef, "config", "", "", "output manifest config file")
cmd.Flags().IntVarP(&opts.concurrency, "concurrency", "", 3, "concurrency level")
cmd.Flags().BoolVarP(&opts.Verbose, "verbose", "v", false, "[Deprecated] verbose output")
_ = cmd.Flags().MarkDeprecated("verbose", "and may be removed in a future release.")

opts.SetTypes(option.FormatTypeText, option.FormatTypeJSON, option.FormatTypeGoTemplate)
option.ApplyFlags(&opts, cmd.Flags())
return oerrors.Command(cmd, &opts.Target)
Expand Down
6 changes: 6 additions & 0 deletions cmd/oras/root/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ type pushOptions struct {
option.ImageSpec
option.Target
option.Format
// Verbose is deprecated. The default behavior is now equivalent to
// Verbose=true, while Verbose=false no longer takes effect.
Verbose bool

extraRefs []string
manifestConfigRef string
Expand Down Expand Up @@ -163,6 +166,9 @@ Example - Push file "hi.txt" into an OCI image layout folder 'layout-dir' with t
cmd.Flags().StringVarP(&opts.manifestConfigRef, "config", "", "", "`path` of image config file")
cmd.Flags().StringVarP(&opts.artifactType, "artifact-type", "", "", "artifact type")
cmd.Flags().IntVarP(&opts.concurrency, "concurrency", "", 5, "concurrency level")
cmd.Flags().BoolVarP(&opts.Verbose, "verbose", "v", false, "[Deprecated] verbose output")
_ = cmd.Flags().MarkDeprecated("verbose", "and may be removed in a future release.")

opts.SetTypes(option.FormatTypeText, option.FormatTypeJSON, option.FormatTypeGoTemplate)
option.ApplyFlags(&opts, cmd.Flags())
return oerrors.Command(cmd, &opts.Target)
Expand Down

0 comments on commit e58b7b5

Please sign in to comment.