fix: Remove MaxDepth references from cmd/web.go

This commit is contained in:
Arik Jones (aider)
2024-10-12 20:45:02 -05:00
parent 8a16cec600
commit 20b6218c7f

View File

@@ -18,7 +18,6 @@ import (
var ( var (
urls []string urls []string
outputType string outputType string
depth int
includeSelector string includeSelector string
excludeSelectors []string excludeSelectors []string
) )
@@ -35,7 +34,6 @@ var webCmd = &cobra.Command{
func init() { func init() {
webCmd.Flags().StringSliceVarP(&urls, "urls", "u", []string{}, "URLs of the webpages to scrape (comma-separated)") webCmd.Flags().StringSliceVarP(&urls, "urls", "u", []string{}, "URLs of the webpages to scrape (comma-separated)")
webCmd.Flags().StringVarP(&outputType, "output", "o", "single", "Output type: 'single' for one file, 'separate' for multiple files") webCmd.Flags().StringVarP(&outputType, "output", "o", "single", "Output type: 'single' for one file, 'separate' for multiple files")
webCmd.Flags().IntVarP(&depth, "depth", "d", 0, "Depth of link traversal (default: 0, only scrape the given URLs)")
webCmd.Flags().StringVar(&includeSelector, "css", "", "CSS selector to extract specific content") webCmd.Flags().StringVar(&includeSelector, "css", "", "CSS selector to extract specific content")
webCmd.Flags().StringSliceVar(&excludeSelectors, "exclude", []string{}, "CSS selectors to exclude from the extracted content (comma-separated)") webCmd.Flags().StringSliceVar(&excludeSelectors, "exclude", []string{}, "CSS selectors to exclude from the extracted content (comma-separated)")
} }
@@ -58,14 +56,13 @@ func runWeb(cmd *cobra.Command, args []string) error {
BaseURL: site.BaseURL, BaseURL: site.BaseURL,
CSSLocator: site.CSSLocator, CSSLocator: site.CSSLocator,
ExcludeSelectors: site.ExcludeSelectors, ExcludeSelectors: site.ExcludeSelectors,
MaxDepth: site.MaxDepth,
AllowedPaths: site.AllowedPaths, AllowedPaths: site.AllowedPaths,
ExcludePaths: site.ExcludePaths, ExcludePaths: site.ExcludePaths,
OutputAlias: site.OutputAlias, OutputAlias: site.OutputAlias,
PathOverrides: convertPathOverrides(site.PathOverrides), PathOverrides: convertPathOverrides(site.PathOverrides),
} }
logger.Printf("Site %d configuration: BaseURL=%s, CSSLocator=%s, MaxDepth=%d, AllowedPaths=%v", logger.Printf("Site %d configuration: BaseURL=%s, CSSLocator=%s, AllowedPaths=%v",
i+1, site.BaseURL, site.CSSLocator, site.MaxDepth, site.AllowedPaths) i+1, site.BaseURL, site.CSSLocator, site.AllowedPaths)
} }
} else { } else {
logger.Printf("No sites defined in rollup.yml, falling back to URL-based configuration") logger.Printf("No sites defined in rollup.yml, falling back to URL-based configuration")
@@ -75,10 +72,9 @@ func runWeb(cmd *cobra.Command, args []string) error {
BaseURL: u, BaseURL: u,
CSSLocator: includeSelector, CSSLocator: includeSelector,
ExcludeSelectors: excludeSelectors, ExcludeSelectors: excludeSelectors,
MaxDepth: depth,
} }
logger.Printf("URL %d configuration: BaseURL=%s, CSSLocator=%s, MaxDepth=%d", logger.Printf("URL %d configuration: BaseURL=%s, CSSLocator=%s",
i+1, u, includeSelector, depth) i+1, u, includeSelector)
} }
} }