summaryrefslogtreecommitdiff
path: root/pkg/commands.go
diff options
context:
space:
mode:
authorJulien Dessaux2024-09-04 09:11:35 +0200
committerJulien Dessaux2024-09-04 09:11:35 +0200
commit00cb3a2488db11c8ce96d182915b8c448edce976 (patch)
tree80d46044e4cdd17c2da324527596e34359a03603 /pkg/commands.go
parentfeat(stdlib): added a basic borg client custom promise (diff)
downloadgonf-00cb3a2488db11c8ce96d182915b8c448edce976.tar.gz
gonf-00cb3a2488db11c8ce96d182915b8c448edce976.tar.bz2
gonf-00cb3a2488db11c8ce96d182915b8c448edce976.zip
chore(gonf): add a DECLARED promise status and make it the default instead of PROMISED
Diffstat (limited to 'pkg/commands.go')
-rw-r--r--pkg/commands.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pkg/commands.go b/pkg/commands.go
index 4222de7..e3f6242 100644
--- a/pkg/commands.go
+++ b/pkg/commands.go
@@ -23,7 +23,7 @@ func CommandWithEnv(env []string, cmd string, args ...string) *CommandPromise {
cmd: cmd,
env: env,
err: nil,
- status: PROMISED,
+ status: DECLARED,
}
}
@@ -44,7 +44,10 @@ func (c *CommandPromise) IfRepaired(p ...Promise) Promise {
}
func (c *CommandPromise) Promise() *CommandPromise {
- commands = append(commands, c)
+ if c.status == DECLARED {
+ c.status = PROMISED
+ commands = append(commands, c)
+ }
return c
}