summaryrefslogtreecommitdiff
path: root/cmd/planr/sub
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/planr/sub')
-rw-r--r--cmd/planr/sub/build.go4
-rw-r--r--cmd/planr/sub/common.go15
-rw-r--r--cmd/planr/sub/evaluate.go4
3 files changed, 20 insertions, 3 deletions
diff --git a/cmd/planr/sub/build.go b/cmd/planr/sub/build.go
index d24bb02..48edd9c 100644
--- a/cmd/planr/sub/build.go
+++ b/cmd/planr/sub/build.go
@@ -4,8 +4,8 @@ import (
"golang.flu0r1ne.net/planr"
)
-
-func Build(runner planr.Runner, params []string) {
+func Build(runner planr.Runner, params []string, cfg planr.Config) {
+ dieIncompatibleVersion(cfg)
tcs := runner.CollectCases()
runner.Build(tcs)
}
diff --git a/cmd/planr/sub/common.go b/cmd/planr/sub/common.go
new file mode 100644
index 0000000..67d07f8
--- /dev/null
+++ b/cmd/planr/sub/common.go
@@ -0,0 +1,15 @@
+package sub
+
+import (
+ "golang.flu0r1ne.net/planr"
+ "os"
+ "fmt"
+)
+
+func dieIncompatibleVersion(cfg planr.Config) {
+ if cfg.IncompatibleWithVersion() {
+ fmt.Fprintf(os.Stderr, "This version of PlanR (%v) is incompatible with config version %s\n", planr.VERSION, cfg.Version)
+ fmt.Fprintf(os.Stderr, "Please upgrade to version %s or greater\n", cfg.Version)
+ os.Exit(1)
+ }
+}
diff --git a/cmd/planr/sub/evaluate.go b/cmd/planr/sub/evaluate.go
index 18cccb1..c2549be 100644
--- a/cmd/planr/sub/evaluate.go
+++ b/cmd/planr/sub/evaluate.go
@@ -4,7 +4,9 @@ import (
"golang.flu0r1ne.net/planr"
)
-func Evaluate(runner planr.Runner, params []string) {
+func Evaluate(runner planr.Runner, params []string, cfg planr.Config) {
+ dieIncompatibleVersion(cfg)
+
tcs := runner.CollectCases()
trs := runner.Evaluate(tcs)