Include empty arrays and maps in the generated Config.md

It's not an ideal solution because there's no indication of what kind of objects
you can add to those maps or arrays, but at least they show up at all (with a
comment containing a link to more information), and that's already an
improvement.
This commit is contained in:
Stefan Haller 2025-03-22 12:24:44 +01:00
parent 0c9154ca9d
commit c3b099398b
2 changed files with 30 additions and 10 deletions

View file

@ -37,6 +37,16 @@ This is only meant as a reference for what config options exist, and what their
```yaml ```yaml
# Config relating to the Lazygit UI # Config relating to the Lazygit UI
gui: gui:
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-author-color
authorColors: {}
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-branch-color
# Deprecated: use branchColorPatterns instead
branchColors: {}
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-branch-color
branchColorPatterns: {}
# The number of lines you scroll by when scrolling the main window # The number of lines you scroll by when scrolling the main window
scrollHeight: 2 scrollHeight: 2
@ -341,12 +351,21 @@ git:
# Deprecated: Use `allBranchesLogCmds` instead. # Deprecated: Use `allBranchesLogCmds` instead.
allBranchesLogCmd: git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium allBranchesLogCmd: git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium
# Commands used to display git log of all branches in the main window, they will be cycled in order of appearance (array of strings)
allBranchesLogCmds: []
# If true, do not spawn a separate process when using GPG # If true, do not spawn a separate process when using GPG
overrideGpg: false overrideGpg: false
# If true, do not allow force pushes # If true, do not allow force pushes
disableForcePushing: false disableForcePushing: false
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
commitPrefix: []
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix
commitPrefixes: {}
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-branch-name-prefix
branchPrefix: "" branchPrefix: ""
@ -459,6 +478,13 @@ os:
# If true, don't display introductory popups upon opening Lazygit. # If true, don't display introductory popups upon opening Lazygit.
disableStartupPopups: false disableStartupPopups: false
# User-configured commands that can be invoked from within Lazygit
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Custom_Command_Keybindings.md
customCommands: []
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-pull-request-urls
services: {}
# What to do when opening Lazygit outside of a git repo. # What to do when opening Lazygit outside of a git repo.
# - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo # - 'prompt': (default) ask whether to initialize a new repo or open in the most recent repo
# - 'create': initialize a new repo # - 'create': initialize a new repo

View file

@ -205,16 +205,6 @@ func recurseOverSchema(rootSchema, schema *jsonschema.Schema, parent *Node) {
for pair := schema.Properties.Oldest(); pair != nil; pair = pair.Next() { for pair := schema.Properties.Oldest(); pair != nil; pair = pair.Next() {
subSchema := getSubSchema(rootSchema, schema, pair.Key) subSchema := getSubSchema(rootSchema, schema, pair.Key)
// Skip empty objects
if subSchema.Type == "object" && subSchema.Properties == nil {
continue
}
// Skip empty arrays
if isZeroValue(subSchema.Default) && subSchema.Type == "array" {
continue
}
node := Node{ node := Node{
Name: pair.Key, Name: pair.Key,
Description: subSchema.Description, Description: subSchema.Description,
@ -235,6 +225,10 @@ func getZeroValue(val any, t string) any {
return "" return ""
case "boolean": case "boolean":
return false return false
case "object":
return map[string]any{}
case "array":
return []any{}
default: default:
return nil return nil
} }