Skip to content

Commit 243ed59

Browse files
committed
pw: simplify VersionFlag type
VersionFlag does not need to be a string with custom Decode and IsBool methods. A plain bool type is sufficient since kong handles bool flags natively and BeforeReset fires before any validation. Signed-off-by: Robin Jarry <robin@jarry.cc>
1 parent ae2c3fe commit 243ed59

1 file changed

Lines changed: 1 addition & 9 deletions

File tree

cmd/pw/main.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,7 @@ func version() string {
5858
return Version
5959
}
6060

61-
type VersionFlag string
62-
63-
func (v VersionFlag) Decode(_ *kong.DecodeContext) error {
64-
return nil
65-
}
66-
67-
func (v VersionFlag) IsBool() bool {
68-
return true
69-
}
61+
type VersionFlag bool
7062

7163
func (v VersionFlag) BeforeReset(app *kong.Kong, vars kong.Vars) error {
7264
fmt.Printf("patchwork %s (%s %s %s %s)\n",

0 commit comments

Comments
 (0)