|
18 | 18 | ;;; Define CLI options |
19 | 19 |
|
20 | 20 | (def cli-options |
21 | | - {:help {:alias :h |
22 | | - :desc "Display this help message"} |
23 | | - :test {:alias :t |
24 | | - :desc "Test with a limited number of hosts (2 by default)"}}) |
| 21 | + {:help {:alias :h |
| 22 | + :desc "Display this help message"} |
| 23 | + :test {:alias :t |
| 24 | + :desc "Test with a limited number of hosts (2 by default)"} |
| 25 | + :forge {:alias :f |
| 26 | + :desc "Limit to a specific forge (e.g., 'github.com')"}}) |
25 | 27 |
|
26 | 28 | (defn- show-help |
27 | 29 | [] |
|
334 | 336 | (defn- set-hosts! [] |
335 | 337 | (when-let [res (fetch-json (:hosts urls))] |
336 | 338 | (reset! hosts |
337 | | - (if-let [test-opt (:test @cli-opts)] |
338 | | - (take (if (int? test-opt) test-opt 2) |
| 339 | + (cond |
| 340 | + ;; Filter by specific host if host option is provided |
| 341 | + (:host @cli-opts) |
| 342 | + (filter #(= (if (= (:name %) "GitHub") "github.com" (:name %)) |
| 343 | + (:host @cli-opts)) |
| 344 | + res) |
| 345 | + ;; Use test option if provided |
| 346 | + (:test @cli-opts) |
| 347 | + (take (if (int? (:test @cli-opts)) (:test @cli-opts) 2) |
339 | 348 | (shuffle res)) |
340 | | - res)))) |
| 349 | + ;; Otherwise use all hosts |
| 350 | + :else res)))) |
341 | 351 |
|
342 | 352 | (defn- update-owners! [] |
343 | 353 | (doseq [[f forge-data] @forges] |
@@ -718,9 +728,9 @@ This list is published under Licence Ouverte 2.0 and CC BY.") |
718 | 728 | (defn- display-data! [] |
719 | 729 | (log/info "Hosts:" (count @hosts)) |
720 | 730 | (log/info "Owners:" (count @owners)) |
721 | | - (log/info "Owners (limited):" (count (owners-as-map @owners))) |
| 731 | + (log/info "Owners (expurged):" (count (owners-as-map @owners))) |
722 | 732 | (log/info "Repositories:" (count @repositories)) |
723 | | - (log/info "Repositories (limited):" (count (repositories-as-map @repositories))) |
| 733 | + (log/info "Repositories (expurged):" (count (repositories-as-map @repositories))) |
724 | 734 | (when-not (:test @cli-opts) |
725 | 735 | (log/info "Awesome codegouvfr:" (count @awesome)))) |
726 | 736 |
|
|
0 commit comments