Fix logging in repo, fix stale auth

This commit is contained in:
2026-02-26 11:23:09 -06:00
parent 385b6ea67c
commit ea7b733767
6 changed files with 84 additions and 58 deletions

View File

@@ -57,6 +57,8 @@ type JsonContent struct {
vimMode bool
cursor int
field *wd.Field
editKey, editVal bool
editValType int
@@ -84,6 +86,7 @@ func (w *JsonContent) Init(id string, style tcell.Style) {
w.id = id
w.style = style
w.visible = true
w.field = wd.NewField(fmt.Sprintf("%s-field", id), style)
w.keyMap = wd.NewKeyMap(
wd.NewKey(wd.BuildEK(tcell.KeyUp), func(_ *tcell.EventKey) bool { return w.MoveUp() }),
wd.NewKey(wd.BuildEK(tcell.KeyDown), func(_ *tcell.EventKey) bool { return w.MoveDown() }),
@@ -148,7 +151,9 @@ func (w *JsonContent) Draw(screen tcell.Screen) {
ln := len(w.contents)
start, end := 0, ln-1
if ln == 0 {
return
if !w.editable {
return
}
}
if ln > w.h-2 {
mid := h / 2
@@ -225,6 +230,12 @@ func (w *JsonContent) MinH() int { return len(w.contents) }
func (w *JsonContent) SetValue(v any) error {
w.value = v
if w.value == nil {
w.valueString = ""
w.contents = []string{}
w.cursor = 0
return nil
}
// Go ahead and try to build the json for v
bts, err := json.MarshalIndent(v, "", " ")
if err != nil {
@@ -253,6 +264,7 @@ func (w *JsonContent) SetValue(v any) error {
}
return err
}
func (w *JsonContent) ClearValue() error { return w.SetValue(nil) }
func (w *JsonContent) SetBorder(brd []rune) {
if len(brd) == 0 {
@@ -376,48 +388,6 @@ func (w *JsonContent) getItemVal(line int) (string, error) {
return "", errors.New("error finding value")
}
/*
func (w *JsonContent) getItemValType(line int) int {
if line < 0 || line >= len(w.contents) {
return JsonTypeErr
}
text := w.contents[line]
key, rest := w.getNextQuotedString(text)
rest = strings.Trim(rest, ", ")
if rest == "" {
if key != "" {
// Looks like a string value in an array
return JsonTypeString
} else rest == "true" || rest == "false" {
return JsonTypeBool
}
// see if we can parse this as a number
num, err := strconv.Atoi(rest)
if err == nil {
return JsonTypeNumber
}
return JsonType
}
if key == "" {
return "", "", errors.New("error finding quoted string")
} else if rest == "" {
// We have a 'key' value, but no 'rest' so this is likely an item in array
return "", key, nil
}
rest = strings.Trim(rest, ":, ")
if rest[0] == '{' {
}
val, rest := w.getNextQuotedString(rest)
if val != "" {
return key, val, nil
}
// Val isn't a quoted string,
return key, rest, nil
}
*/
func (w *JsonContent) getItemDepth(line int) int {
if line < 0 || line >= len(w.contents) {
return 0