From bc14726c1b868e0e66d00ee0d02f8769dd153f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20W=C3=BChr?= Date: Thu, 25 Jul 2024 18:36:55 +0200 Subject: [PATCH] Add some ideas for git commands --- cmd/feature.ab | 18 ++++++++++++++++-- config.ab | 11 +++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 config.ab diff --git a/cmd/feature.ab b/cmd/feature.ab index 34743a6..39dd225 100644 --- a/cmd/feature.ab +++ b/cmd/feature.ab @@ -1,9 +1,23 @@ +import * from "../config.ab" + +fun branch(feature: Text): Text { + let prefix = get_feature_prefix() + + return "{prefix}{feature}" +} + fun feature_start(feature: Text, description: Text): Null { - echo "Create feature {feature} ({description})" + let branch = branch(feature) + let base = get_dev_branch() + + echo "git switch -c {branch} {base}" + echo "git config --no-add branch.\"{branch}\".description \"{description}\"" } fun feature_checkout(feature: Text): Null { - echo "Checkout feature {feature}" + let branch = branch(feature) + + echo "git checkout \"{branch}\"" } fun feature_publish(feature: Text): Null { diff --git a/config.ab b/config.ab new file mode 100644 index 0000000..83caf1b --- /dev/null +++ b/config.ab @@ -0,0 +1,11 @@ +pub fun get_feature_prefix(): Text { + return "feature/" +} + +pub fun get_dev_branch(): Text { + return "develop" +} + +pub fun get_push_remote(): Text { + return "origin" +} \ No newline at end of file