Files
rph/utils/boolFlag.go
Squibid 12cefa9092 feat: inital commit
- added template subcmd which generates frc project templates
2025-10-14 23:48:14 -04:00

30 lines
405 B
Go

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"
}