mirror of
https://github.com/Squibid/rph.git
synced 2025-10-20 03:44:04 +00:00
feat: inital commit
- added template subcmd which generates frc project templates
This commit is contained in:
29
utils/boolFlag.go
Normal file
29
utils/boolFlag.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
type BoolFlag struct {
|
||||
IsSet bool
|
||||
Value bool
|
||||
}
|
||||
|
||||
func (b *BoolFlag) String() string {
|
||||
return fmt.Sprintf("%v", b.Value)
|
||||
}
|
||||
|
||||
func (b *BoolFlag) Set(s string) error {
|
||||
v, err := strconv.ParseBool(s)
|
||||
if err != nil {
|
||||
return fmt.Errorf("invalid boolean: %s", s)
|
||||
}
|
||||
b.IsSet = true
|
||||
b.Value = v
|
||||
return nil
|
||||
}
|
||||
|
||||
func (b *BoolFlag) Type() string {
|
||||
return "bool"
|
||||
}
|
Reference in New Issue
Block a user