Skip to content

Commit

Permalink
fix: allow config file to load showLineNumbers
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
prithvijj committed Oct 16, 2024
1 parent f1b5651 commit 1a9a7de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 1a9a7de

Please sign in to comment.