Skip to content

Commit 0b0adf1

Browse files
committed
NegatedBoolValue: move to a separate file
1 parent 8aa7551 commit 0b0adf1

2 files changed

Lines changed: 31 additions & 26 deletions

File tree

git-sizer.go

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -79,32 +79,6 @@ const Usage = `usage: git-sizer [OPTS]
7979
var ReleaseVersion string
8080
var BuildVersion string
8181

82-
type NegatedBoolValue struct {
83-
value *bool
84-
}
85-
86-
func (v *NegatedBoolValue) Set(s string) error {
87-
b, err := strconv.ParseBool(s)
88-
*v.value = !b
89-
return err
90-
}
91-
92-
func (v *NegatedBoolValue) Get() interface{} {
93-
return !*v.value
94-
}
95-
96-
func (v *NegatedBoolValue) String() string {
97-
if v == nil || v.value == nil {
98-
return "true"
99-
} else {
100-
return strconv.FormatBool(!*v.value)
101-
}
102-
}
103-
104-
func (v *NegatedBoolValue) Type() string {
105-
return "bool"
106-
}
107-
10882
type filterValue struct {
10983
// The filter to which values will be appended:
11084
filter *git.IncludeExcludeFilter

negated_bool_value.go

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package main
2+
3+
import (
4+
"strconv"
5+
)
6+
7+
type NegatedBoolValue struct {
8+
value *bool
9+
}
10+
11+
func (v *NegatedBoolValue) Set(s string) error {
12+
b, err := strconv.ParseBool(s)
13+
*v.value = !b
14+
return err
15+
}
16+
17+
func (v *NegatedBoolValue) Get() interface{} {
18+
return !*v.value
19+
}
20+
21+
func (v *NegatedBoolValue) String() string {
22+
if v == nil || v.value == nil {
23+
return "true"
24+
} else {
25+
return strconv.FormatBool(!*v.value)
26+
}
27+
}
28+
29+
func (v *NegatedBoolValue) Type() string {
30+
return "bool"
31+
}

0 commit comments

Comments
 (0)