Skip to content

Commit

Permalink
deduplicate warning while copying
Browse files Browse the repository at this point in the history
Signed-off-by: Billy Zha <[email protected]>
  • Loading branch information
qweeah committed Aug 22, 2023
1 parent 11c46b7 commit e8a3a30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/oras/internal/option/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ func (opts *Remote) EnableDistributionSpecFlag() {
func (opts *Remote) ApplyFlags(fs *pflag.FlagSet) {
opts.ApplyFlagsWithPrefix(fs, "", "")
fs.BoolVarP(&opts.PasswordFromStdin, "password-stdin", "", false, "read password or identity token from stdin")
opts.warned = &sync.Map{}
}

func applyPrefix(prefix, description string) (flagPrefix, notePrefix string) {
Expand Down Expand Up @@ -107,7 +108,6 @@ func (opts *Remote) ApplyFlagsWithPrefix(fs *pflag.FlagSet, prefix, description

// Parse tries to read password with optional cmd prompt.
func (opts *Remote) Parse() error {
opts.warned = &sync.Map{}
if err := opts.parseCustomHeaders(); err != nil {
return err
}
Expand Down
3 changes: 3 additions & 0 deletions cmd/oras/internal/option/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"fmt"
"os"
"strings"
"sync"

"github.com/sirupsen/logrus"
"github.com/spf13/pflag"
Expand Down Expand Up @@ -200,6 +201,8 @@ func (opts *BinaryTarget) ApplyFlags(fs *pflag.FlagSet) {
opts.From.ApplyFlagsWithPrefix(fs, "from", "source")
opts.To.ApplyFlagsWithPrefix(fs, "to", "destination")
fs.StringArrayVarP(&opts.resolveFlag, "resolve", "", nil, "base DNS rules formatted in `host:port:address[:address_port]` for --from-resolve and --to-resolve")
opts.From.warned = &sync.Map{}
opts.To.warned = opts.From.warned
}

// Parse parses user-provided flags and arguments into option struct.
Expand Down

0 comments on commit e8a3a30

Please sign in to comment.