From 1a9a7de03598d4accaa5ba2a86010b84e61bd12c Mon Sep 17 00:00:00 2001 From: Prithvi Jethwa Date: Wed, 16 Oct 2024 09:11:18 -0400 Subject: [PATCH] fix: allow config file to load `showLineNumbers` - Added in a fix to allow the `showLineNumbers` config option to be loaded from the config file - Previously it seems unclear on how to setup the `showLineNumbers` key within the config, and while there was support added for configuring the `showLineNumbers` flag, it couldn't be read from the config file, since the `validateOptions` method would not retrieve the key from the config file - Hence changed it so that it does retrieve the `showLineNumbers` key from the config file, and use it as needed - Updated the README.md to also provide an example on how to setup both the keys --- README.md | 4 ++++ main.go | 1 + 2 files changed, 5 insertions(+) diff --git a/README.md b/README.md index 1e811677..4cc40a0c 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,10 @@ pager: true width: 80 # show all files, including hidden and ignored. all: true +# show line numbers (TUI-mode only) +showLineNumbers: false +# preserve newlines in the output +preserveNewLines: false ``` ## Feedback diff --git a/main.go b/main.go index fb3ce57e..e331dbf5 100644 --- a/main.go +++ b/main.go @@ -148,6 +148,7 @@ func validateOptions(cmd *cobra.Command) error { pager = viper.GetBool("pager") showAllFiles = viper.GetBool("all") preserveNewLines = viper.GetBool("preserveNewLines") + showLineNumbers = viper.GetBool("showLineNumbers") // validate the glamour style style = viper.GetString("style")