From 519cc0145464a61ebb2b52eea433c6aa85ef2c62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20W=C3=BChr?= Date: Thu, 25 Jul 2024 17:59:52 +0200 Subject: [PATCH] First idea of something --- .gitignore | 1 + Makefile | 4 ++++ cmd/feature.ab | 44 ++++++++++++++++++++++++++++++++++++++++++++ main.ab | 18 ++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 .gitignore create mode 100644 Makefile create mode 100644 cmd/feature.ab create mode 100644 main.ab diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..567609b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +build/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e98a63b --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ +.PHONY: build/git-workflow + +build/git-workflow: + amber main.ab $@ \ No newline at end of file diff --git a/cmd/feature.ab b/cmd/feature.ab new file mode 100644 index 0000000..34743a6 --- /dev/null +++ b/cmd/feature.ab @@ -0,0 +1,44 @@ +fun feature_start(feature: Text, description: Text): Null { + echo "Create feature {feature} ({description})" +} + +fun feature_checkout(feature: Text): Null { + echo "Checkout feature {feature}" +} + +fun feature_publish(feature: Text): Null { + echo "Publish feature {feature}" +} + +fun feature_finish(feature: Text): Null { + echo "Finish feature {feature}" +} + +fun feature_delete(feature: Text): Null { + echo "Delete feature {feature}" +} + +fun feature_rebase(feature: Text): Null { + echo "Rebase feature {feature}" +} + +fun help(args: [Text]): Null { + echo "Feature help" +} + +pub fun feature_cmd(args: [Text]): Null { + let cmd = args[1] + let feature = args[2] + + if { + cmd == "": help(args) + cmd == "start": feature_start(feature, args[3]) + cmd == "checkout": feature_checkout(feature) + cmd == "publish": feature_publish(feature) + cmd == "finish": feature_finish(feature) + cmd == "rebase": feature_rebase(feature) + cmd == "delete": feature_delete(feature) + else: echo "Unknown command feature '{cmd}'" + } +} + diff --git a/main.ab b/main.ab new file mode 100644 index 0000000..df16887 --- /dev/null +++ b/main.ab @@ -0,0 +1,18 @@ +import { feature_cmd } from "./cmd/feature.ab" + +fun help(args: [Text]): Null { + echo "help" +} + +main(args) { + let cmd = args[0] + + if { + cmd == "" { help(args) } + cmd == "feature" { feature_cmd(args) } + else { + echo "unknown command '{cmd}'" + fail 1 + } + } +} \ No newline at end of file