Skip to content

Commit

Permalink
Make --all configurable globally
Browse files Browse the repository at this point in the history
  • Loading branch information
Stanislav (Stas) Katkov committed Sep 29, 2024
1 parent 67243bb commit 2b4466a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ var (
pager bool
style string
width uint
all bool
showAllFiles bool
showLineNumbers bool
preserveNewLines bool
Expand Down Expand Up @@ -146,6 +147,8 @@ func validateOptions(cmd *cobra.Command) error {
width = viper.GetUint("width")
mouse = viper.GetBool("mouse")
pager = viper.GetBool("pager")
all = viper.GetBool("all")
fmt.Println("All: ", all)
preserveNewLines = viper.GetBool("preserveNewLines")

// validate the glamour style
Expand Down Expand Up @@ -315,7 +318,11 @@ func runTUI(workingDirectory string) error {

cfg.WorkingDirectory = workingDirectory

cfg.ShowAllFiles = showAllFiles
if showAllFiles {
cfg.ShowAllFiles = showAllFiles
} else {
cfg.ShowAllFiles = all
}
cfg.ShowLineNumbers = showLineNumbers
cfg.GlamourMaxWidth = width
cfg.GlamourStyle = style
Expand Down

0 comments on commit 2b4466a

Please sign in to comment.