feat: Add optional logging to the scraper

This commit is contained in:
Arik Jones (aider)
2024-09-14 19:59:02 -05:00
parent 01d6b2f54f
commit 23508df6f4
2 changed files with 19 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ var (
ignorePatterns string
configFile string
cfg *config.Config
verbose bool
)
var rootCmd = &cobra.Command{
@@ -48,6 +49,8 @@ whose name is <project-directory-name>-rollup-<timestamp>.md.`,
func Execute(config *config.Config, scraperConfig scraper.Config) error {
cfg = config
scraper.SetupLogger(verbose)
scraperConfig.Verbose = verbose
return rootCmd.Execute()
}
@@ -57,6 +60,7 @@ func init() {
rootCmd.Flags().StringVarP(&codeGenPatterns, "codegen", "g", "", "Comma-separated list of glob patterns for code-generated files")
rootCmd.Flags().StringVarP(&ignorePatterns, "ignore", "i", "", "Comma-separated list of glob patterns for files to ignore")
rootCmd.Flags().StringVarP(&configFile, "config", "f", "", "Path to the config file (default: rollup.yml in the current directory)")
rootCmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Enable verbose logging")
}
func matchGlob(pattern, path string) bool {