diff options
| author | s <[email protected]> | 2025-11-18 06:36:53 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-18 06:36:53 -0500 |
| commit | d77b81ec36a6995af6a8039121d19802bab8352e (patch) | |
| tree | f898f85631367b899ae3c75fbd117f185d07233d /cmd | |
| parent | 76d0cff639988ca506b1dc6e848841944c96b263 (diff) | |
| download | dborg-0.8.5.tar.gz dborg-0.8.5.zip | |
chore: remove api documentation and refactor github leads + crawl commands to add new parametersv0.8.5
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/crawl.go | 5 | ||||
| -rw-r--r-- | cmd/github.go | 21 |
2 files changed, 19 insertions, 7 deletions
diff --git a/cmd/crawl.go b/cmd/crawl.go index 3587eb0..d889e1d 100644 --- a/cmd/crawl.go +++ b/cmd/crawl.go @@ -16,15 +16,18 @@ var crawlCmd = &cobra.Command{ func init() { rootCmd.AddCommand(crawlCmd) + crawlCmd.Flags().Bool("subdomains", false, "Also discover and crawl all subdomains using subfinder") } func runCrawl(cmd *cobra.Command, args []string) error { + subdomains, _ := cmd.Flags().GetBool("subdomains") + c, err := newUnauthenticatedClient() if err != nil { return err } - err = c.CrawlDomain(args[0], func(line string) error { + err = c.CrawlDomain(args[0], subdomains, func(line string) error { fmt.Println(line) return nil }) diff --git a/cmd/github.go b/cmd/github.go index 6cc1951..83b9601 100644 --- a/cmd/github.go +++ b/cmd/github.go @@ -17,8 +17,8 @@ var githubCmd = &cobra.Command{ var githubLeadsCmd = &cobra.Command{ Use: "leads [query]", Short: "Search GitHub repositories for commit authors", - Long: `Scans GitHub repositories for commit author information based on search query and streams results as NDJSON`, - Args: cobra.ExactArgs(1), + Long: `Scans GitHub repositories for commit author information based on search query and streams results as NDJSON. If no query is provided, returns random leads.`, + Args: cobra.MaximumNArgs(1), RunE: runGitHubLeads, } @@ -28,24 +28,33 @@ func init() { githubLeadsCmd.Flags().String("sort", "stars", "Sort method (stars, forks, updated)") githubLeadsCmd.Flags().String("exclude", "", "Comma-separated terms to exclude from search") + githubLeadsCmd.Flags().String("format", "json", "Output format (json, csv)") + githubLeadsCmd.Flags().String("bio", "false", "Include bio info (true/false) - adds company, location, website, twitter, pfp") } func runGitHubLeads(cmd *cobra.Command, args []string) error { + query := "" + if len(args) > 0 { + query = args[0] + } + sort, _ := cmd.Flags().GetString("sort") exclude, _ := cmd.Flags().GetString("exclude") + format, _ := cmd.Flags().GetString("format") + bio, _ := cmd.Flags().GetString("bio") c, err := newUnauthenticatedClient() if err != nil { return err } - err = c.SearchGitHubLeadsWithParams(args[0], sort, exclude, func(result json.RawMessage) error { - var streamResp models.GitHubLeadsStreamResponse - if err := json.Unmarshal(result, &streamResp); err != nil { + err = c.SearchGitHubLeadsWithParams(query, sort, exclude, format, bio, func(result json.RawMessage) error { + var lead models.GitHubLead + if err := json.Unmarshal(result, &lead); err != nil { return err } - output, err := formatter.FormatGitHubLeads(&streamResp, IsJSONOutput()) + output, err := formatter.FormatGitHubLeads(&lead, IsJSONOutput()) if err != nil { return err } |
