Skip to content

Commit

Permalink
fix: resolve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <[email protected]>
  • Loading branch information
JeyJeyGao committed Dec 30, 2024
1 parent 8ecf320 commit b595f64
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/notation/blob/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// Package blob provides the command for blob trust policy configuration.
// Package blob provides blob sign, verify, inspect, and policy commands.
package blob

import (
Expand Down
6 changes: 3 additions & 3 deletions cmd/notation/blob/policy/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Example - Import trust policy configuration from a file:
return runImport(opts)
},
}
command.Flags().BoolVar(&opts.force, "force", false, "override the existing trust policy configuration, never prompt")
command.Flags().BoolVar(&opts.force, "force", false, "override the existing blob trust policy configuration, never prompt")
return command
}

Expand Down Expand Up @@ -82,7 +82,7 @@ func runImport(opts importOpts) error {
}
}
} else {
fmt.Fprintln(os.Stderr, "Warning: existing blob trust policy configuration file will be overwritten")
fmt.Fprintln(os.Stderr, "Warning: existing blob trust policy file will be overwritten")
}

// write
Expand All @@ -94,6 +94,6 @@ func runImport(opts importOpts) error {
return fmt.Errorf("failed to write blob trust policy file: %w", err)
}

_, err = fmt.Fprintln(os.Stdout, "Blob trust policy configuration imported successfully.")
_, err = fmt.Fprintln(os.Stdout, "Successfully imported blob trust policy file.")
return err
}
6 changes: 3 additions & 3 deletions cmd/notation/blob/policy/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ func runShow() error {
err = doc.Validate()
}
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %s\n", err.Error())
fmt.Fprintf(os.Stderr, "Existing blob trust policy configuration is invalid, you may update or create a new one via `notation blob policy import <path-to-policy.json>`\n")
// not returning to show the invalid policy configuration
fmt.Fprintf(os.Stderr, "Existing blob trust policy file is invalid, you may update or create a new one via `notation blob policy import <path-to-policy.json>`\n")
os.Stdout.Write(policyJSON)
return err
}

// show policy content
Expand Down
4 changes: 2 additions & 2 deletions cmd/notation/policy/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func runImport(opts importOpts) error {
}
}
} else {
fmt.Fprintln(os.Stderr, "Warning: existing trust policy configuration file will be overwritten")
fmt.Fprintln(os.Stderr, "Warning: existing trust policy file will be overwritten")
}

// write
Expand All @@ -106,6 +106,6 @@ func runImport(opts importOpts) error {
fmt.Fprintf(os.Stderr, "Warning: failed to clear old trust policy %q: %v\n", oldPolicyPath, err)
}

_, err = fmt.Fprintln(os.Stdout, "Trust policy configuration imported successfully.")
_, err = fmt.Fprintln(os.Stdout, "Successfully imported trust policy file.")
return err
}
2 changes: 1 addition & 1 deletion cmd/notation/policy/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func runShow() error {
}
if err != nil {
fmt.Fprintf(os.Stderr, "Error: %s\n", err.Error())
fmt.Fprintf(os.Stderr, "Existing trust policy configuration is invalid, you may update or create a new one via `notation policy import <path-to-policy.json>`\n")
fmt.Fprintf(os.Stderr, "Existing trust policy file is invalid, you may update or create a new one via `notation policy import <path-to-policy.json>`\n")
// not returning to show the invalid policy configuration
}

Expand Down

0 comments on commit b595f64

Please sign in to comment.