add a 'forge mode' concept

This commit is contained in:
Jeff Carr 2025-03-02 03:03:45 -06:00
parent f540aab434
commit 9d5bae8a14
2 changed files with 25 additions and 0 deletions

View File

@ -36,6 +36,13 @@ message ForgeConfig { // `autogenpb:nom
string goSrc = 13; // is ~/go/src unless a go.work file is found
}
// todo: fix autogenpb to look for enum
enum ForgeMode {
MASTER = 0; // "release mode"
DEVEL = 1; // "patch mode"
USER = 2; // "work mode"
}
message ForgeConfigs { // `autogenpb:marshal` `autogenpb:nomutex`
string uuid = 1; // `autogenpb:uuid:1941cd4f-1cfd-4bf6-aa75-c2c391907e81`
string version = 2; // `autogenpb:version:v0.0.47`
@ -44,4 +51,5 @@ message ForgeConfigs { // `autogenpb:mar
string xterm = 5; // what xterm the user wants as the default
repeated string xtermArgv = 6; // the argv line for xterm
string defaultGui = 7; // default GUI plugin to use
ForgeMode mode = 8; // what "mode" forge is in
}

17
mode.go Normal file
View File

@ -0,0 +1,17 @@
// Copyright 1994-2025 WIT.COM Inc Licensed GPL 3.0
package forgepb
// TODO: implement i18n with the protobuf's
func (f *Forge) GetMode() string {
switch f.Config.Mode {
case ForgeMode_MASTER:
return "Release Mode (master branches)"
case ForgeMode_DEVEL:
return "Devel/Patch Mode (devel branches)"
case ForgeMode_USER:
return "Hack Mode (user branches)"
default:
return f.Config.Mode.String()
}
}