Skip to content

Commit 930b725

Browse files
committed
refactor: make token request and token read flags mutually exclusive
1 parent 3162384 commit 930b725

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

cmd/jwtinfo.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ Examples:
5252
https-wrench jwtinfo --request-url $REQ_URL --request-values-json $REQ_VALUES --validation-url $VALIDATION_URL
5353
`,
5454
Run: func(cmd *cobra.Command, args []string) {
55-
// TODO: display version and exit
5655
// TODO: remove global --config option
5756

5857
var err error
@@ -177,7 +176,7 @@ func init() {
177176
"Url of the JSON Web Key Set (JWKS) to use for validating the JWT token",
178177
)
179178

180-
// Cobra supports local flags which will only run when this command
181-
// is called directly, e.g.:
182-
// jwtinfoCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
179+
// Either read a token from a file or request it from an HTTP address
180+
jwtinfoCmd.MarkFlagsMutuallyExclusive(flagNameTokenFile, flagNameRequestURL)
181+
jwtinfoCmd.MarkFlagsOneRequired(flagNameTokenFile, flagNameRequestURL)
183182
}

0 commit comments

Comments
 (0)