Skip to content

Commit af419c8

Browse files
authored
feat(validate): add brief summary after validation (#128)
1 parent 4b252e9 commit af419c8

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

plugins/repos-validate/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,10 @@ Example output:
8282

8383
```console
8484
✅ config.yaml syntax is valid.
85+
42 repositories in config
86+
15 unique tags: api, backend, cli, deprecated, frontend, gh:automation, gh:cli, gh:rust, java, javascript, microservice, python, rust, typescript, web
87+
88+
Validation finished successfully.
8589
```
8690

8791
### Validate syntax and check repository connectivity
@@ -97,6 +101,8 @@ Example output:
97101

98102
```console
99103
✅ config.yaml syntax is valid.
104+
42 repositories in config
105+
15 unique tags: api, backend, cli, deprecated, frontend, gh:automation, gh:cli, gh:rust, java, javascript, microservice, python, rust, typescript, web
100106

101107
Validating repository connectivity...
102108
✅ codcod/repos: Accessible.
@@ -118,6 +124,8 @@ Example output:
118124

119125
```console
120126
✅ config.yaml syntax is valid.
127+
42 repositories in config
128+
15 unique tags: api, backend, cli, deprecated, frontend, gh:automation, gh:cli, gh:rust, java, javascript, microservice, python, rust, typescript, web
121129

122130
Validating repository connectivity...
123131
✅ codcod/repos: Accessible.
@@ -141,6 +149,8 @@ Example output:
141149

142150
```console
143151
✅ config.yaml syntax is valid.
152+
42 repositories in config
153+
15 unique tags: api, backend, cli, deprecated, frontend, gh:automation, gh:cli, gh:rust, java, javascript, microservice, python, rust, typescript, web
144154

145155
Validating repository connectivity...
146156
✅ codcod/repos: Accessible.

plugins/repos-validate/src/main.rs

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,21 @@ async fn main() -> Result<()> {
3838
}
3939

4040
println!("{}", "✅ config.yaml syntax is valid.".green());
41+
42+
// Display summary information
43+
println!(" {} repositories in config", repos.len());
44+
45+
// Collect and display unique tags
46+
let unique_tags = get_unique_tags(&repos);
47+
if !unique_tags.is_empty() {
48+
println!(
49+
" {} unique tags: {}",
50+
unique_tags.len(),
51+
unique_tags.join(", ")
52+
);
53+
} else {
54+
println!(" No tags defined");
55+
}
4156
println!();
4257

4358
if !args.connect {
@@ -192,6 +207,20 @@ fn parse_github_url(url: &str) -> Result<(String, String)> {
192207
anyhow::bail!("Unsupported repository URL format: {}", url)
193208
}
194209

210+
fn get_unique_tags(repos: &[Repository]) -> Vec<String> {
211+
let mut tags: HashSet<String> = HashSet::new();
212+
213+
for repo in repos {
214+
for tag in &repo.tags {
215+
tags.insert(tag.clone());
216+
}
217+
}
218+
219+
let mut sorted_tags: Vec<String> = tags.into_iter().collect();
220+
sorted_tags.sort();
221+
sorted_tags
222+
}
223+
195224
fn get_config_path() -> Result<PathBuf> {
196225
// Try to get config path from environment variable set by repos CLI
197226
if let Ok(config) = std::env::var("REPOS_CONFIG_FILE") {

0 commit comments

Comments
 (0)