Skip to content

Commit

Permalink
fix: resolve comments
Browse files Browse the repository at this point in the history
Signed-off-by: Junjie Gao <junjiegao@microsoft.com>
  • Loading branch information
JeyJeyGao committed Jan 14, 2025
1 parent f44f524 commit 77278ff
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/cmd/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ var (
Usage: "signature envelope format, options: \"jws\", \"cose\"",
}
SetPflagSignatureFormat = func(fs *pflag.FlagSet, p *string) {
defaultSignatureFormat := envelope.JWS
// load config to get signatureFormat
config, err := configutil.LoadConfigOnce()
if err == nil && config.SignatureFormat != "" {
defaultSignatureFormat = config.SignatureFormat
if err != nil || config.SignatureFormat == "" {
fs.StringVar(p, PflagSignatureFormat.Name, envelope.JWS, PflagSignatureFormat.Usage)
return

Check warning on line 50 in internal/cmd/flags.go

View check run for this annotation

Codecov / codecov/patch

internal/cmd/flags.go#L49-L50

Added lines #L49 - L50 were not covered by tests
}

fs.StringVar(p, PflagSignatureFormat.Name, defaultSignatureFormat, PflagSignatureFormat.Usage)
// set signatureFormat from config
fs.StringVar(p, PflagSignatureFormat.Name, config.SignatureFormat, PflagSignatureFormat.Usage)
}

PflagID = &pflag.Flag{
Expand Down

0 comments on commit 77278ff

Please sign in to comment.