mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-15 03:37:52 +08:00
Add a "bool" builtin.
This commit is contained in:
parent
4c938c7393
commit
5ef87a7e7a
|
@ -92,6 +92,7 @@ func init() {
|
|||
|
||||
&BuiltinFn{"base", wrapFn(base)},
|
||||
|
||||
&BuiltinFn{"bool", wrapFn(boolFn)},
|
||||
&BuiltinFn{"==", eq},
|
||||
&BuiltinFn{"!=", wrapFn(noteq)},
|
||||
&BuiltinFn{"deepeq", deepeq},
|
||||
|
@ -599,6 +600,11 @@ func base(ec *EvalCtx, b int, nums ...int) {
|
|||
}
|
||||
}
|
||||
|
||||
func boolFn(ec *EvalCtx, v Value) {
|
||||
out := ec.ports[1].Chan
|
||||
out <- Bool(ToBool(v))
|
||||
}
|
||||
|
||||
var ErrNotEqual = errors.New("not equal")
|
||||
|
||||
func eq(ec *EvalCtx, args []Value) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user