mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-04 10:57:50 +08:00
92fb6e5161
This fixes #15. Only string is supported ATM.
20 lines
362 B
Go
20 lines
362 B
Go
package eval
|
|
|
|
import "github.com/elves/elvish/store"
|
|
|
|
type sharedVariable struct {
|
|
store *store.Store
|
|
name string
|
|
}
|
|
|
|
func (sv sharedVariable) Set(val Value) {
|
|
err := sv.store.SetSharedVar(sv.name, ToString(val))
|
|
maybeThrow(err)
|
|
}
|
|
|
|
func (sv sharedVariable) Get() Value {
|
|
value, err := sv.store.GetSharedVar(sv.name)
|
|
maybeThrow(err)
|
|
return String(value)
|
|
}
|