Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <[email protected]>
  • Loading branch information
qweeah committed Mar 30, 2023
1 parent 322bca3 commit e355030
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions cmd/oras/internal/option/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (opts *Common) ApplyFlags(fs *pflag.FlagSet) {
fs.BoolVarP(&opts.Verbose, "verbose", "v", false, "verbose output")
}

// WithLogger sets a logger to ctx with proper logging options tuned.
func (opts *Common) WithLogger(ctx context.Context) (context.Context, logrus.FieldLogger) {
// WithContext returns a new FieldLogger and an associated Context derived from ctx.
func (opts *Common) WithContext(ctx context.Context) (context.Context, logrus.FieldLogger) {
return trace.NewLogger(ctx, opts.Debug, opts.Verbose)
}
2 changes: 1 addition & 1 deletion cmd/oras/root/attach.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Example - Attach file to the manifest tagged 'v1' in an OCI layout folder 'layou
}

func runAttach(opts attachOptions, cmd *cobra.Command) error {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())
annotations, err := opts.LoadManifestAnnotations()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/blob/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Example - Delete a blob and print its descriptor:
}

func deleteBlob(opts deleteBlobOptions, cmd *cobra.Command) (err error) {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())
repo, err := opts.NewRepository(opts.targetRef, opts.Common)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/blob/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Example - Fetch and print a blob from OCI image layout archive file 'layout.tar'
}

func fetchBlob(opts fetchBlobOptions, cmd *cobra.Command) (fetchErr error) {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())
var target oras.ReadOnlyTarget
target, err := opts.NewReadonlyTarget(ctx, opts.Common)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/blob/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Example - Push blob 'hi.txt' into an OCI layout folder 'layout-dir':
}

func pushBlob(opts pushBlobOptions, cmd *cobra.Command) (err error) {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())

repo, err := opts.NewTarget(opts.Common)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/cp.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Example - Copy an artifact with multiple tags with concurrency tuned:
}

func runCopy(opts copyOptions, cmd *cobra.Command) error {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())

// Prepare source
src, err := opts.From.NewReadonlyTarget(ctx, opts.Common)
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/discover.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ Example - Discover referrers of the manifest tagged 'v1' in an OCI layout folder
}

func runDiscover(opts discoverOptions, cmd *cobra.Command) error {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())
repo, err := opts.NewReadonlyTarget(ctx, opts.Common)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Example - Log in with username and password in an interactive terminal and no TL
}

func runLogin(opts loginOptions, cmd *cobra.Command) (err error) {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())

// prompt for credential
if opts.Password == "" {
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/manifest/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Example - Delete a manifest by digest 'sha256:99e4703fbf30916f549cd6bfa9cdbab614
}

func deleteManifest(opts deleteOptions, cmd *cobra.Command) error {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())
repo, err := opts.NewRepository(opts.targetRef, opts.Common)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/manifest/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Example - Fetch raw manifest from an OCI layout archive file 'layout.tar':
}

func fetchManifest(opts fetchOptions, cmd *cobra.Command) (fetchErr error) {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())

target, err := opts.NewReadonlyTarget(ctx, opts.Common)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/manifest/fetch_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Example - Fetch and print the prettified descriptor of the config:
}

func fetchConfig(opts fetchConfigOptions, cmd *cobra.Command) (fetchErr error) {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())

repo, err := opts.NewReadonlyTarget(ctx, opts.Common)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/manifest/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Example - Push a manifest to an OCI layout folder 'layout-dir' and tag with 'v1'
}

func pushManifest(opts pushOptions, cmd *cobra.Command) error {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())
var target oras.Target
var err error
target, err = opts.NewTarget(opts.Common)
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Example - Pull artifact files from an OCI layout archive 'layout.tar':
}

func runPull(opts pullOptions, cmd *cobra.Command) error {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())
// Copy Options
var printed sync.Map
copyOptions := oras.DefaultCopyOptions
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/push.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ Example - Push file "hi.txt" into an OCI layout folder 'layout-dir' with tag 'te
}

func runPush(opts pushOptions, cmd *cobra.Command) error {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())
annotations, err := opts.LoadManifestAnnotations()
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/repo/ls.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Example - List the repositories under the registry that include values lexically
}

func listRepository(opts repositoryOptions, cmd *cobra.Command) error {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())
reg, err := opts.Remote.NewRegistry(opts.hostname, opts.Common)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/repo/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Example - Show tags associated with a digest:
}

func showTags(opts showTagsOptions, cmd *cobra.Command) error {
ctx, logger := opts.WithLogger(cmd.Context())
ctx, logger := opts.WithContext(cmd.Context())
finder, err := opts.NewReadonlyTarget(ctx, opts.Common)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion cmd/oras/root/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Example - Tag the manifest 'v1.0.1' to 'v1.0.2' in an OCI layout folder 'layout-
}

func tagManifest(opts tagOptions, cmd *cobra.Command) error {
ctx, _ := opts.WithLogger(cmd.Context())
ctx, _ := opts.WithContext(cmd.Context())
target, err := opts.NewTarget(opts.Common)
if err != nil {
return err
Expand Down

0 comments on commit e355030

Please sign in to comment.