mirror of
https://github.com/onyx-and-iris/xair-cli.git
synced 2026-04-09 02:13:35 +00:00
snapshot commands implemented
This commit is contained in:
@@ -16,7 +16,7 @@ func NewSnapshot(c *Client) *Snapshot {
|
||||
|
||||
// Name gets the name of the snapshot at the given index.
|
||||
func (s *Snapshot) Name(index int) (string, error) {
|
||||
address := s.baseAddress + fmt.Sprintf("/name/%d", index)
|
||||
address := s.baseAddress + fmt.Sprintf("/%02d/name", index)
|
||||
err := s.client.SendMessage(address)
|
||||
if err != nil {
|
||||
return "", err
|
||||
@@ -35,24 +35,30 @@ func (s *Snapshot) Name(index int) (string, error) {
|
||||
|
||||
// SetName sets the name of the snapshot at the given index.
|
||||
func (s *Snapshot) SetName(index int, name string) error {
|
||||
address := s.baseAddress + fmt.Sprintf("/name/%d", index)
|
||||
address := s.baseAddress + fmt.Sprintf("/%02d/name", index)
|
||||
return s.client.SendMessage(address, name)
|
||||
}
|
||||
|
||||
// Load loads the snapshot at the given index.
|
||||
func (s *Snapshot) Load(index int) error {
|
||||
address := s.baseAddress + fmt.Sprintf("/load/%d", index)
|
||||
return s.client.SendMessage(address)
|
||||
// CurrentName sets the name of the current snapshot.
|
||||
func (s *Snapshot) CurrentName(name string) error {
|
||||
address := s.baseAddress + "/name"
|
||||
return s.client.SendMessage(address, name)
|
||||
}
|
||||
|
||||
// Save saves the current state to the snapshot at the given index.
|
||||
func (s *Snapshot) Save(index int) error {
|
||||
address := s.baseAddress + fmt.Sprintf("/save/%d", index)
|
||||
return s.client.SendMessage(address)
|
||||
// CurrentLoad loads the snapshot at the given index.
|
||||
func (s *Snapshot) CurrentLoad(index int) error {
|
||||
address := s.baseAddress + "/load"
|
||||
return s.client.SendMessage(address, int32(index))
|
||||
}
|
||||
|
||||
// Delete deletes the snapshot at the given index.
|
||||
func (s *Snapshot) Delete(index int) error {
|
||||
address := s.baseAddress + fmt.Sprintf("/delete/%d", index)
|
||||
return s.client.SendMessage(address)
|
||||
// CurrentSave saves the current state to the snapshot at the given index.
|
||||
func (s *Snapshot) CurrentSave(index int) error {
|
||||
address := s.baseAddress + "/save"
|
||||
return s.client.SendMessage(address, int32(index))
|
||||
}
|
||||
|
||||
// CurrentDelete deletes the snapshot at the given index.
|
||||
func (s *Snapshot) CurrentDelete(index int) error {
|
||||
address := s.baseAddress + "/delete"
|
||||
return s.client.SendMessage(address, int32(index))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user