mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-13 01:47:51 +08:00
20 lines
363 B
Go
20 lines
363 B
Go
package eval
|
|
|
|
import "github.com/elves/elvish/daemon/api"
|
|
|
|
type sharedVariable struct {
|
|
store *api.Client
|
|
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.SharedVar(sv.name)
|
|
maybeThrow(err)
|
|
return String(value)
|
|
}
|