From 4bfda1a78c5ab769d7cfe91874287c0ee33f2800 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 31 May 2024 20:07:58 +0200 Subject: [PATCH] Fix boolean config keys not appearing in the generated Config.md The reason why they didn't appear is that they didn't get a default value in the generated schema; this commit fixes that. --- docs/Config.md | 53 ++++++++++++++++++++++++++++++++++++++ pkg/jsonschema/generate.go | 2 +- schema/config.json | 51 ++++++++++++++++++++++++------------ 3 files changed, 88 insertions(+), 18 deletions(-) diff --git a/docs/Config.md b/docs/Config.md index b9b325e9a..b14ee993a 100644 --- a/docs/Config.md +++ b/docs/Config.md @@ -49,10 +49,25 @@ gui: # When mouse events are captured, it's a little harder to select text: e.g. requiring you to hold the option key when on macOS. mouseEvents: true + # If true, do not show a warning when discarding changes in the staging view. + skipDiscardChangeWarning: false + + # If true, do not show warning when applying/popping the stash + skipStashWarning: false + + # If true, do not show a warning when attempting to commit without any staged files; instead stage all unstaged files. + skipNoStagedFilesWarning: false + + # If true, do not show a warning when rewording a commit via an external editor + skipRewordInEditorWarning: false + # Fraction of the total screen width to use for the left side section. You may want to pick a small number (e.g. 0.2) if you're using a narrow screen, so that you can see more of the main section. # Number from 0 to 1.0. sidePanelWidth: 0.3333 + # If true, increase the height of the focused side window; creating an accordion effect. + expandFocusedSidePanel: false + # Sometimes the main window is split in two (e.g. when the selected file has both staged and unstaged changes). This setting controls how the two sections are split. # Options are: # - 'horizontal': split the window horizontally @@ -151,6 +166,9 @@ gui: # If true, show jump-to-window keybindings in window titles. showPanelJumps: true + # Deprecated: use nerdFontsVersion instead + showIcons: false + # Nerd fonts version to use. # One of: '2' | '3' | empty string (default) # If empty, do not show icons. @@ -162,6 +180,9 @@ gui: # Length of commit hash in commits view. 0 shows '*' if NF icons aren't on. commitHashLength: 8 + # If true, show commit hashes alongside branch names in the branches view. + showBranchCommitHash: false + # Height of the command log view commandLogSize: 8 @@ -218,11 +239,17 @@ git: # ydiff -p cat -s --wrap --width={{columnWidth}} pager: "" + # If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager). + useConfig: false + # e.g. 'difft --color=always' externalDiffCommand: "" # Config relating to committing commit: + # If true, pass '--signoff' flag when committing + signOff: false + # Automatic WYSIWYG wrapping of the commit message as you type autoWrapCommitMessage: true @@ -231,6 +258,10 @@ git: # Config relating to merging merging: + # If true, run merges in a subprocess so that if a commit message is required, Lazygit will not hang + # Only applicable to unix users. + manualCommit: false + # Extra args passed to `git merge`, e.g. --no-ff args: "" @@ -257,6 +288,12 @@ git: # Command used to display git log of all branches in the main window allBranchesLogCmd: git log --graph --all --color=always --abbrev-commit --decorate --date=relative --pretty=medium + # If true, do not spawn a separate process when using GPG + overrideGpg: false + + # If true, do not allow force pushes + disableForcePushing: false + # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#predefined-commit-message-prefix commitPrefix: # pattern to match on. E.g. for 'feature/AB-123' to match on the AB-123 use "^\\w+\\/(\\w+-\\w+).*" @@ -265,6 +302,10 @@ git: # Replace directive. E.g. for 'feature/AB-123' to start the commit message with 'AB-123 ' use "[$1] " replace: "" + # If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀 + # (This should really be under 'gui', not 'git') + parseEmoji: false + # Config for showing the log in the commits view log: # One of: 'date-order' | 'author-date-order' | 'topo-order' | 'default' @@ -280,6 +321,9 @@ git: # Deprecated: Configure this with `Log menu -> Show git graph` ( in the commits window by default). showGraph: always + # displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`) + showWholeGraph: false + # When copying commit hashes to the clipboard, truncate them to this # length. Set to 40 to disable truncation. truncateCopiedCommitHashesTo: 12 @@ -302,6 +346,12 @@ refresher: # Auto-fetch can be disabled via option 'git.autoFetch'. fetchInterval: 60 +# If true, show a confirmation popup before quitting Lazygit +confirmOnQuit: false + +# If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close +quitOnTopLevelReturn: false + # Config relating to things outside of Lazygit like how files are opened, copying to clipboard, etc os: # Command for editing a file. Should contain "{{filename}}". @@ -351,6 +401,9 @@ os: # See https://github.com/jesseduffield/lazygit/blob/master/docs/Config.md#custom-command-for-copying-to-clipboard copyToClipboardCmd: "" +# If true, don't display introductory popups upon opening Lazygit. +disableStartupPopups: false + # 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 # - 'create': initialize a new repo diff --git a/pkg/jsonschema/generate.go b/pkg/jsonschema/generate.go index 38b582844..582e84849 100644 --- a/pkg/jsonschema/generate.go +++ b/pkg/jsonschema/generate.go @@ -78,7 +78,7 @@ func isZeroValue(v any) bool { case string: return v == "" case bool: - return !v + return false case nil: return true } diff --git a/schema/config.json b/schema/config.json index 8df3e1b2b..a5c704db0 100644 --- a/schema/config.json +++ b/schema/config.json @@ -46,19 +46,23 @@ }, "skipDiscardChangeWarning": { "type": "boolean", - "description": "If true, do not show a warning when discarding changes in the staging view." + "description": "If true, do not show a warning when discarding changes in the staging view.", + "default": false }, "skipStashWarning": { "type": "boolean", - "description": "If true, do not show warning when applying/popping the stash" + "description": "If true, do not show warning when applying/popping the stash", + "default": false }, "skipNoStagedFilesWarning": { "type": "boolean", - "description": "If true, do not show a warning when attempting to commit without any staged files; instead stage all unstaged files." + "description": "If true, do not show a warning when attempting to commit without any staged files; instead stage all unstaged files.", + "default": false }, "skipRewordInEditorWarning": { "type": "boolean", - "description": "If true, do not show a warning when rewording a commit via an external editor" + "description": "If true, do not show a warning when rewording a commit via an external editor", + "default": false }, "sidePanelWidth": { "type": "number", @@ -69,7 +73,8 @@ }, "expandFocusedSidePanel": { "type": "boolean", - "description": "If true, increase the height of the focused side window; creating an accordion effect." + "description": "If true, increase the height of the focused side window; creating an accordion effect.", + "default": false }, "mainPanelSplitMode": { "type": "string", @@ -293,7 +298,8 @@ }, "showIcons": { "type": "boolean", - "description": "Deprecated: use nerdFontsVersion instead" + "description": "Deprecated: use nerdFontsVersion instead", + "default": false }, "nerdFontsVersion": { "type": "string", @@ -317,7 +323,8 @@ }, "showBranchCommitHash": { "type": "boolean", - "description": "If true, show commit hashes alongside branch names in the branches view." + "description": "If true, show commit hashes alongside branch names in the branches view.", + "default": false }, "commandLogSize": { "type": "integer", @@ -439,7 +446,8 @@ }, "useConfig": { "type": "boolean", - "description": "If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager)." + "description": "If true, Lazygit will use whatever pager is specified in `$GIT_PAGER`, `$PAGER`, or your *git config*. If the pager ends with something like ` | less` we will strip that part out, because less doesn't play nice with our rendering approach. If the custom pager uses less under the hood, that will also break rendering (hence the `--paging=never` flag for the `delta` pager).", + "default": false }, "externalDiffCommand": { "type": "string", @@ -454,7 +462,8 @@ "properties": { "signOff": { "type": "boolean", - "description": "If true, pass '--signoff' flag when committing" + "description": "If true, pass '--signoff' flag when committing", + "default": false }, "autoWrapCommitMessage": { "type": "boolean", @@ -475,7 +484,8 @@ "properties": { "manualCommit": { "type": "boolean", - "description": "If true, run merges in a subprocess so that if a commit message is required, Lazygit will not hang\nOnly applicable to unix users." + "description": "If true, run merges in a subprocess so that if a commit message is required, Lazygit will not hang\nOnly applicable to unix users.", + "default": false }, "args": { "type": "string", @@ -533,11 +543,13 @@ }, "overrideGpg": { "type": "boolean", - "description": "If true, do not spawn a separate process when using GPG" + "description": "If true, do not spawn a separate process when using GPG", + "default": false }, "disableForcePushing": { "type": "boolean", - "description": "If true, do not allow force pushes" + "description": "If true, do not allow force pushes", + "default": false }, "commitPrefix": { "properties": { @@ -586,7 +598,8 @@ }, "parseEmoji": { "type": "boolean", - "description": "If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀\n(This should really be under 'gui', not 'git')" + "description": "If true, parse emoji strings in commit messages e.g. render :rocket: as 🚀\n(This should really be under 'gui', not 'git')", + "default": false }, "log": { "properties": { @@ -613,7 +626,8 @@ }, "showWholeGraph": { "type": "boolean", - "description": "displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`)" + "description": "displays the whole git graph by default in the commits view (equivalent to passing the `--all` argument to `git log`)", + "default": false } }, "additionalProperties": false, @@ -674,11 +688,13 @@ }, "confirmOnQuit": { "type": "boolean", - "description": "If true, show a confirmation popup before quitting Lazygit" + "description": "If true, show a confirmation popup before quitting Lazygit", + "default": false }, "quitOnTopLevelReturn": { "type": "boolean", - "description": "If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close" + "description": "If true, exit Lazygit when the user presses escape in a context where there is nothing to cancel/close", + "default": false }, "os": { "properties": { @@ -752,7 +768,8 @@ }, "disableStartupPopups": { "type": "boolean", - "description": "If true, don't display introductory popups upon opening Lazygit." + "description": "If true, don't display introductory popups upon opening Lazygit.", + "default": false }, "customCommands": { "items": {