mirror of
https://github.com/cedar2025/hysteria.git
synced 2025-06-08 21:39:56 +00:00
29 lines
420 B
Go
29 lines
420 B
Go
package main
|
|
|
|
import (
|
|
"strconv"
|
|
)
|
|
|
|
type optionalBoolFlag struct {
|
|
Exists bool
|
|
Value bool
|
|
}
|
|
|
|
func (flag *optionalBoolFlag) String() string {
|
|
return strconv.FormatBool(flag.Value)
|
|
}
|
|
|
|
func (flag *optionalBoolFlag) Set(s string) error {
|
|
v, err := strconv.ParseBool(s)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
flag.Exists = true
|
|
flag.Value = v
|
|
return nil
|
|
}
|
|
|
|
func (flag *optionalBoolFlag) IsBoolFlag() bool {
|
|
return true
|
|
}
|