Skip to content

Commit 3b85307

Browse files
committed
Filter out [dev] comments when generating config doc
1 parent 30e9bf8 commit 3b85307

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

Diff for: docs/Config.md

-2
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,6 @@ os:
412412
editAtLineAndWait: ""
413413

414414
# Whether lazygit suspends until an edit process returns
415-
# Pointer to bool so that we can distinguish unset (nil) from false.
416-
# We're naming this `editInTerminal` for backwards compatibility
417415
editInTerminal: false
418416

419417
# For opening a directory in an editor

Diff for: pkg/config/user_config.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -557,8 +557,8 @@ type OSConfig struct {
557557
EditAtLineAndWait string `yaml:"editAtLineAndWait,omitempty"`
558558

559559
// Whether lazygit suspends until an edit process returns
560-
// Pointer to bool so that we can distinguish unset (nil) from false.
561-
// We're naming this `editInTerminal` for backwards compatibility
560+
// [dev] Pointer to bool so that we can distinguish unset (nil) from false.
561+
// [dev] We're naming this `editInTerminal` for backwards compatibility
562562
SuspendOnEdit *bool `yaml:"editInTerminal,omitempty"`
563563

564564
// For opening a directory in an editor

Diff for: pkg/jsonschema/generate_config_docs.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,20 @@ func prepareMarshalledConfig(buffer bytes.Buffer) []byte {
7777
}
7878

7979
func setComment(yamlNode *yaml.Node, description string) {
80+
// Filter out lines containing "[dev]"; this allows us to add developer
81+
// documentation to properties that don't get included in the docs
82+
lines := strings.Split(description, "\n")
83+
lines = lo.Filter(lines, func(s string, _ int) bool {
84+
return !strings.Contains(s, "[dev]")
85+
})
86+
8087
// Workaround for the way yaml formats the HeadComment if it contains
8188
// blank lines: it renders these without a leading "#", but we want a
8289
// leading "#" even on blank lines. However, yaml respects it if the
8390
// HeadComment already contains a leading "#", so we prefix all lines
8491
// (including blank ones) with "#".
8592
yamlNode.HeadComment = strings.Join(
86-
lo.Map(strings.Split(description, "\n"), func(s string, _ int) string {
93+
lo.Map(lines, func(s string, _ int) string {
8794
if s == "" {
8895
return "#" // avoid trailing space on blank lines
8996
}

Diff for: schema/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1468,7 +1468,7 @@
14681468
},
14691469
"editInTerminal": {
14701470
"type": "boolean",
1471-
"description": "Whether lazygit suspends until an edit process returns\nPointer to bool so that we can distinguish unset (nil) from false.\nWe're naming this `editInTerminal` for backwards compatibility"
1471+
"description": "Whether lazygit suspends until an edit process returns\n[dev] Pointer to bool so that we can distinguish unset (nil) from false.\n[dev] We're naming this `editInTerminal` for backwards compatibility"
14721472
},
14731473
"openDirInEditor": {
14741474
"type": "string",

0 commit comments

Comments
 (0)