aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-23 06:05:05 -0700
committerFuwn <[email protected]>2024-10-23 06:05:05 -0700
commit49e21d633c14f639659c8ec3312bb808dec3005e (patch)
tree0d0f65a11910081f7036859ee028fe9a6dc49cfd /internal
parentcb482154c1c9647d747cc15314f424d7be606569 (diff)
downloadyae-49e21d633c14f639659c8ec3312bb808dec3005e.tar.xz
yae-49e21d633c14f639659c8ec3312bb808dec3005e.zip
feat(yae): dry-run flag
Diffstat (limited to 'internal')
-rw-r--r--internal/commands/add.go4
-rw-r--r--internal/commands/drop.go4
-rw-r--r--internal/commands/init.go4
-rw-r--r--internal/commands/update.go2
4 files changed, 13 insertions, 1 deletions
diff --git a/internal/commands/add.go b/internal/commands/add.go
index e32d07d..1b32533 100644
--- a/internal/commands/add.go
+++ b/internal/commands/add.go
@@ -107,6 +107,10 @@ func Add(sources *yae.Sources) func(c *cli.Context) error {
return err
}
+ if c.Bool("dry-run") {
+ return nil
+ }
+
return sources.Save(c.String("sources"))
}
}
diff --git a/internal/commands/drop.go b/internal/commands/drop.go
index 58855df..f30afb6 100644
--- a/internal/commands/drop.go
+++ b/internal/commands/drop.go
@@ -19,6 +19,10 @@ func Drop(sources *yae.Sources) func(c *cli.Context) error {
sources.Drop(c.Args().Get(0))
+ if c.Bool("dry-run") {
+ return nil
+ }
+
return sources.Save(c.String("sources"))
}
}
diff --git a/internal/commands/init.go b/internal/commands/init.go
index f38ec96..4d41553 100644
--- a/internal/commands/init.go
+++ b/internal/commands/init.go
@@ -14,6 +14,10 @@ func Init(sources *yae.Sources) func(c *cli.Context) error {
return fmt.Errorf("sources file already exists")
}
+ if c.Bool("dry-run") {
+ return nil
+ }
+
return sources.Save(c.String("sources"))
}
}
diff --git a/internal/commands/update.go b/internal/commands/update.go
index b1ce17b..fa7e09f 100644
--- a/internal/commands/update.go
+++ b/internal/commands/update.go
@@ -53,7 +53,7 @@ func Update(sources *yae.Sources) func(c *cli.Context) error {
}
}
- if len(updates) > 0 {
+ if len(updates) > 0 && !c.Bool("dry-run") {
if err := sources.Save(c.String("sources")); err != nil {
return err
}