First idea of something

This commit is contained in:
Alex 2024-07-25 17:59:52 +02:00
parent c495f7498b
commit 519cc01454
Signed by: l-x
SSH key fingerprint: SHA256:MK3uQVPHEV0Oo2ry/dAqvVK3pAwegKAwSlyfgLd/yQM
4 changed files with 67 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
build/

4
Makefile Normal file
View file

@ -0,0 +1,4 @@
.PHONY: build/git-workflow
build/git-workflow:
amber main.ab $@

44
cmd/feature.ab Normal file
View file

@ -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}'"
}
}

18
main.ab Normal file
View file

@ -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
}
}
}