Skip to content

Commit 67b0db0

Browse files
authored
Filter out deprecated user config fields from generated Config.md (#4416)
- **PR Description** This removes generated Config.md entries that are contain the word: `deprecated` (case insensitive) anywhere in their header comment. I think adding in deprecated configs into the reference config clutters it at best, and encourages users to use those configs at worst. They are still going to be validated by the schema, but this PR removes them from the generated config. I also added in the missing `deprecated` yaml tags in our user config in anticipation of invopop/jsonschema#79 getting merged.
2 parents d8e2819 + a64c32d commit 67b0db0

File tree

3 files changed

+11
-49
lines changed

3 files changed

+11
-49
lines changed

docs/Config.md

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ gui:
4040
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-author-color
4141
authorColors: {}
4242

43-
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-branch-color
44-
# Deprecated: use branchColorPatterns instead
45-
branchColors: {}
46-
4743
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-branch-color
4844
branchColorPatterns: {}
4945

@@ -200,9 +196,6 @@ gui:
200196
# If true, show jump-to-window keybindings in window titles.
201197
showPanelJumps: true
202198

203-
# Deprecated: use nerdFontsVersion instead
204-
showIcons: false
205-
206199
# Nerd fonts version to use.
207200
# One of: '2' | '3' | empty string (default)
208201
# If empty, do not show icons.
@@ -347,10 +340,6 @@ git:
347340
# Command used when displaying the current branch git log in the main window
348341
branchLogCmd: git log --graph --color=always --abbrev-commit --decorate --date=relative --pretty=medium {{branchName}} --
349342

350-
# Command used to display git log of all branches in the main window.
351-
# Deprecated: Use `allBranchesLogCmds` instead.
352-
allBranchesLogCmd: git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium
353-
354343
# Commands used to display git log of all branches in the main window, they will be cycled in order of appearance (array of strings)
355344
allBranchesLogCmds: []
356345

@@ -375,19 +364,6 @@ git:
375364

376365
# Config for showing the log in the commits view
377366
log:
378-
# One of: 'date-order' | 'author-date-order' | 'topo-order' | 'default'
379-
# 'topo-order' makes it easier to read the git log graph, but commits may not
380-
# appear chronologically. See https://git-scm.com/docs/
381-
#
382-
# Deprecated: Configure this with `Log menu -> Commit sort order` (<c-l> in the commits window by default).
383-
order: topo-order
384-
385-
# This determines whether the git graph is rendered in the commits panel
386-
# One of 'always' | 'never' | 'when-maximised'
387-
#
388-
# Deprecated: Configure this with `Log menu -> Show git graph` (<c-l> in the commits window by default).
389-
showGraph: always
390-
391367
# displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`)
392368
showWholeGraph: false
393369

@@ -449,24 +425,6 @@ os:
449425
# Command for opening a link. Should contain "{{link}}".
450426
openLink: ""
451427

452-
# EditCommand is the command for editing a file.
453-
# Deprecated: use Edit instead. Note that semantics are different:
454-
# EditCommand is just the command itself, whereas Edit contains a
455-
# "{{filename}}" variable.
456-
editCommand: ""
457-
458-
# EditCommandTemplate is the command template for editing a file
459-
# Deprecated: use EditAtLine instead.
460-
editCommandTemplate: ""
461-
462-
# OpenCommand is the command for opening a file
463-
# Deprecated: use Open instead.
464-
openCommand: ""
465-
466-
# OpenLinkCommand is the command for opening a link
467-
# Deprecated: use OpenLink instead.
468-
openLinkCommand: ""
469-
470428
# CopyToClipboardCmd is the command for copying to clipboard.
471429
# See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard
472430
copyToClipboardCmd: ""

pkg/config/user_config.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type GuiConfig struct {
5454
AuthorColors map[string]string `yaml:"authorColors"`
5555
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-branch-color
5656
// Deprecated: use branchColorPatterns instead
57-
BranchColors map[string]string `yaml:"branchColors"`
57+
BranchColors map[string]string `yaml:"branchColors" jsonschema:"deprecated"`
5858
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-branch-color
5959
BranchColorPatterns map[string]string `yaml:"branchColorPatterns"`
6060
// The number of lines you scroll by when scrolling the main window
@@ -131,7 +131,7 @@ type GuiConfig struct {
131131
// If true, show jump-to-window keybindings in window titles.
132132
ShowPanelJumps bool `yaml:"showPanelJumps"`
133133
// Deprecated: use nerdFontsVersion instead
134-
ShowIcons bool `yaml:"showIcons"`
134+
ShowIcons bool `yaml:"showIcons" jsonschema:"deprecated"`
135135
// Nerd fonts version to use.
136136
// One of: '2' | '3' | empty string (default)
137137
// If empty, do not show icons.
@@ -252,7 +252,7 @@ type GitConfig struct {
252252
BranchLogCmd string `yaml:"branchLogCmd"`
253253
// Command used to display git log of all branches in the main window.
254254
// Deprecated: Use `allBranchesLogCmds` instead.
255-
AllBranchesLogCmd string `yaml:"allBranchesLogCmd"`
255+
AllBranchesLogCmd string `yaml:"allBranchesLogCmd" jsonschema:"deprecated"`
256256
// Commands used to display git log of all branches in the main window, they will be cycled in order of appearance (array of strings)
257257
AllBranchesLogCmds []string `yaml:"allBranchesLogCmds"`
258258
// If true, do not spawn a separate process when using GPG
@@ -587,19 +587,19 @@ type OSConfig struct {
587587
// Deprecated: use Edit instead. Note that semantics are different:
588588
// EditCommand is just the command itself, whereas Edit contains a
589589
// "{{filename}}" variable.
590-
EditCommand string `yaml:"editCommand,omitempty"`
590+
EditCommand string `yaml:"editCommand,omitempty" jsonschema:"deprecated"`
591591

592592
// EditCommandTemplate is the command template for editing a file
593593
// Deprecated: use EditAtLine instead.
594-
EditCommandTemplate string `yaml:"editCommandTemplate,omitempty"`
594+
EditCommandTemplate string `yaml:"editCommandTemplate,omitempty" jsonschema:"deprecated"`
595595

596596
// OpenCommand is the command for opening a file
597597
// Deprecated: use Open instead.
598-
OpenCommand string `yaml:"openCommand,omitempty"`
598+
OpenCommand string `yaml:"openCommand,omitempty" jsonschema:"deprecated"`
599599

600600
// OpenLinkCommand is the command for opening a link
601601
// Deprecated: use OpenLink instead.
602-
OpenLinkCommand string `yaml:"openLinkCommand,omitempty"`
602+
OpenLinkCommand string `yaml:"openLinkCommand,omitempty" jsonschema:"deprecated"`
603603

604604
// CopyToClipboardCmd is the command for copying to clipboard.
605605
// See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-and-pasting-from-clipboard

pkg/jsonschema/generate_config_docs.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,10 @@ func recurseOverSchema(rootSchema, schema *jsonschema.Schema, parent *Node) {
205205
for pair := schema.Properties.Oldest(); pair != nil; pair = pair.Next() {
206206
subSchema := getSubSchema(rootSchema, schema, pair.Key)
207207

208+
if strings.Contains(strings.ToLower(subSchema.Description), "deprecated") {
209+
continue
210+
}
211+
208212
node := Node{
209213
Name: pair.Key,
210214
Description: subSchema.Description,

0 commit comments

Comments
 (0)