Private
Public Access
1
0

Add validation to command line flags + update system prompt handling

Renamed `applyPromptFlags` to `applyGenerationFlags` and added
`validateGenerationFlags`
This commit is contained in:
2024-06-23 04:47:47 +00:00
parent 677cfcfebf
commit f89cc7b410
11 changed files with 90 additions and 44 deletions

View File

@@ -21,7 +21,7 @@ func InputFromEditor(placeholder string, pattern string, content string) (string
msgFile, _ := os.CreateTemp("/tmp", pattern)
defer os.Remove(msgFile.Name())
os.WriteFile(msgFile.Name(), []byte(placeholder + content), os.ModeAppend)
os.WriteFile(msgFile.Name(), []byte(placeholder+content), os.ModeAppend)
editor := os.Getenv("EDITOR")
if editor == "" {
@@ -137,8 +137,8 @@ func SetStructDefaults(data interface{}) bool {
}
// Get the "default" struct tag
defaultTag := v.Type().Field(i).Tag.Get("default")
if defaultTag == "" {
defaultTag, ok := v.Type().Field(i).Tag.Lookup("default")
if (!ok) {
continue
}