File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import (
1414 "fmt"
1515 "os"
1616 "path/filepath"
17+ "slices"
1718
1819 "github.com/alecthomas/kong"
1920 "github.com/google/go-github/v88/github"
@@ -44,7 +45,8 @@ consistent with the SHA listed in "openapi_commit". This is run in CI as a conve
4445changes to openapi_operations.yaml.
4546` ,
4647
47- "output_json_help" : `Output JSON.` ,
48+ "unused_deprecated_help" : `Only list deprecated operations in openapi_operations.yaml that aren't used by any service methods.` ,
49+ "output_json_help" : `Output JSON.` ,
4850}
4951
5052type rootCmd struct {
@@ -142,7 +144,8 @@ func (c *updateGoCmd) Run(root *rootCmd) error {
142144}
143145
144146type unusedCmd struct {
145- JSON bool `kong:"help=${output_json_help}"`
147+ Deprecated bool `kong:"help=${unused_deprecated_help}"`
148+ JSON bool `kong:"help=${output_json_help}"`
146149}
147150
148151func (c * unusedCmd ) Run (root * rootCmd , k * kong.Context ) error {
@@ -154,6 +157,11 @@ func (c *unusedCmd) Run(root *rootCmd, k *kong.Context) error {
154157 if err != nil {
155158 return err
156159 }
160+ if c .Deprecated {
161+ unused = slices .DeleteFunc (unused , func (op * operation ) bool {
162+ return ! op .Deprecated
163+ })
164+ }
157165 if c .JSON {
158166 enc := json .NewEncoder (k .Stdout )
159167 enc .SetIndent ("" , " " )
You can’t perform that action at this time.
0 commit comments