mirror of
https://github.com/tnypxl/rollup.git
synced 2025-12-15 15:03:17 +00:00
fix: resolve undefined config variable in cmd/files.go
This commit is contained in:
17
cmd/files.go
17
cmd/files.go
@@ -8,8 +8,11 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
"github.com/tnypxl/rollup/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var cfg *config.Config
|
||||||
|
|
||||||
var (
|
var (
|
||||||
path string
|
path string
|
||||||
fileTypes string
|
fileTypes string
|
||||||
@@ -103,21 +106,21 @@ func isIgnored(filePath string, patterns []string) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func runRollup(config *config.Config) error {
|
func runRollup(cfg *config.Config) error {
|
||||||
// Use config if available, otherwise use command-line flags
|
// Use config if available, otherwise use command-line flags
|
||||||
var types, codeGenList, ignoreList []string
|
var types, codeGenList, ignoreList []string
|
||||||
if config != nil && len(config.FileTypes) > 0 {
|
if cfg != nil && len(cfg.FileTypes) > 0 {
|
||||||
types = config.FileTypes
|
types = cfg.FileTypes
|
||||||
} else {
|
} else {
|
||||||
types = strings.Split(fileTypes, ",")
|
types = strings.Split(fileTypes, ",")
|
||||||
}
|
}
|
||||||
if config != nil && len(config.CodeGenerated) > 0 {
|
if cfg != nil && len(cfg.CodeGenerated) > 0 {
|
||||||
codeGenList = config.CodeGenerated
|
codeGenList = cfg.CodeGenerated
|
||||||
} else {
|
} else {
|
||||||
codeGenList = strings.Split(codeGenPatterns, ",")
|
codeGenList = strings.Split(codeGenPatterns, ",")
|
||||||
}
|
}
|
||||||
if config != nil && config.Ignore != nil && len(config.Ignore) > 0 {
|
if cfg != nil && cfg.Ignore != nil && len(cfg.Ignore) > 0 {
|
||||||
ignoreList = config.Ignore
|
ignoreList = cfg.Ignore
|
||||||
} else {
|
} else {
|
||||||
ignoreList = strings.Split(ignorePatterns, ",")
|
ignoreList = strings.Split(ignorePatterns, ",")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user