summaryrefslogtreecommitdiff
path: root/config.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-10-31 09:13:02 -0500
committerJeff Carr <[email protected]>2024-10-31 09:13:02 -0500
commitcc0ca1dd7caf5aa93624428a2d254b71e8b09a81 (patch)
tree2ed32f655977bea77da308265df8af30d15032b9 /config.go
parent1ca936e98e910280a63ef72502a1c017e92aa4e2 (diff)
add flags for marking droplets as archived
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'config.go')
-rw-r--r--config.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/config.go b/config.go
index 4ae6f31..2fd4c33 100644
--- a/config.go
+++ b/config.go
@@ -23,9 +23,18 @@ func (c *Cluster) ConfigSave() error {
return err
}
+ // make a new droplets struct
var d *Droplets
d = new(Droplets)
d.Droplets = c.Droplets
+ // copy all the records over to the new struct
+ for _, drop := range c.Droplets {
+ d.Droplets = append(d.Droplets, drop)
+ }
+ // delete all the Current data so it's not put in the config file
+ for _, drop := range d.Droplets {
+ drop.Current = nil
+ }
if err := ConfigWriteJSON(d, "droplets.json"); err != nil {
fmt.Println("droplets.json write failed")
return err
@@ -139,6 +148,8 @@ func (c *Cluster) ConfigLoad() error {
e = new(Events)
if c.E == nil {
+ // this seems to panic on nil. something is wrong about doing this
+ // does it not stay allocated after this function ends?
c.E = new(Events)
}
if err := e.loadEvents(); err != nil {