Skip to content

Commit

Permalink
resolved comments
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaoxuan Wang <wangxiaoxuan119@gmail.com>
  • Loading branch information
wangxiaoxuan273 committed Mar 27, 2024
1 parent 358414f commit 6df6d6f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions cmd/oras/internal/option/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ func (opts *Remote) ApplyFlagsWithPrefix(fs *pflag.FlagSet, prefix, description

// CheckStdinConflict checks if opts.PasswordFromStdin or opts.IdentityTokenFromStdin
// conflicts with read file from input.
func (opts *Remote) CheckStdinConflict(usage string) error {
func (opts *Remote) CheckStdinConflict() error {
if opts.PasswordFromStdin {
return fmt.Errorf("%s and `--%s` read password from input cannot be both used", usage, passwordFromStdinFlag)
return fmt.Errorf("`-` read file from input and `--%s` read password from input cannot be both used", passwordFromStdinFlag)
} else if opts.IdentityTokenFromStdin {
return fmt.Errorf("%s and `--%s` read identity token from input cannot be both used", usage, identityTokenFromStdinFlag)
return fmt.Errorf("`-` read file from input and `--%s` read identity token from input cannot be both used", identityTokenFromStdinFlag)
}
return 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 @@ -80,7 +80,7 @@ Example - Push blob 'hi.txt' into an OCI image layout folder 'layout-dir':
opts.RawReference = args[0]
opts.fileRef = args[1]
if opts.fileRef == "-" {
if err := opts.CheckStdinConflict("`-` read file from input"); err != nil {
if err := opts.CheckStdinConflict(); err != nil {
return err
}
if opts.size < 0 {
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 @@ -87,7 +87,7 @@ Example - Push a manifest to an OCI image layout folder 'layout-dir' and tag wit
PreRunE: func(cmd *cobra.Command, args []string) error {
opts.fileRef = args[1]
if opts.fileRef == "-" {
if err := opts.CheckStdinConflict("`-` read file from input"); err != nil {
if err := opts.CheckStdinConflict(); err != nil {
return err
}
}
Expand Down

0 comments on commit 6df6d6f

Please sign in to comment.