Skip to content

Commit

Permalink
define apiconfig exts globally
Browse files Browse the repository at this point in the history
  • Loading branch information
rusq committed Jan 4, 2025
1 parent 8d92f24 commit ffef555
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion cmd/slackdump/internal/apiconfig/apiconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ configuration file.
},
}

var ConfigExts = []string{"*.toml", "*.tml"}

var ErrConfigInvalid = errors.New("config validation failed")

// Load reads, parses and validates the config file.
Expand Down Expand Up @@ -83,7 +85,7 @@ func printErrors(w io.Writer, err error) error {
}

var wErr error
var printErr = func(format string, a ...any) {
printErr := func(format string, a ...any) {
if wErr != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/slackdump/internal/apiconfig/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func CheckFile(filename string) error {
}

func wizConfigCheck(ctx context.Context, cmd *base.Command, args []string) error {
f := filemgr.New(os.DirFS("."), ".", 15, "*.toml", "*.tml")
f := filemgr.New(os.DirFS("."), ".", 15, ConfigExts...)
f.Focus()
f.ShowHelp = true
f.Style = filemgr.Style{
Expand Down
2 changes: 1 addition & 1 deletion cmd/slackdump/internal/ui/cfgui/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func globalConfig() Configuration {
Description: "API limits file",
Updater: updaters.NewFilepickModel(
&cfg.ConfigFile,
filemgr.New(os.DirFS("."), ".", 15, "*.toml", "*.tml"),
filemgr.New(os.DirFS("."), ".", 15, apiconfig.ConfigExts...),
validateAPIconfig,
),
},
Expand Down

0 comments on commit ffef555

Please sign in to comment.