fix: filter tags from registry
This commit is contained in:
parent
fa9aa4e74b
commit
be99d9c21a
@ -23,7 +23,7 @@ fn main() {
|
||||
let args = Args::parse();
|
||||
let query_args = QueryArgs::new(args.repository.as_str(), args.filter, args.arch);
|
||||
let config = docker_config::read_config();
|
||||
let tags = match config {
|
||||
let mut tags = match config {
|
||||
None => {
|
||||
let fetcher = DockerHubTagsFetcher::new();
|
||||
fetcher.get_tags(&query_args)
|
||||
@ -33,6 +33,7 @@ fn main() {
|
||||
fetcher.get_tags(&query_args)
|
||||
}
|
||||
};
|
||||
tags.sort();
|
||||
for tag in tags {
|
||||
let _ = writeln!(std::io::stdout(), "{}", &tag);
|
||||
}
|
||||
|
@ -93,7 +93,6 @@ impl DockerTagsFetcher for DockerHubTagsFetcher {
|
||||
for x in &filtered {
|
||||
results.push(x.name.clone().unwrap());
|
||||
}
|
||||
results.sort();
|
||||
results
|
||||
}
|
||||
}
|
@ -44,6 +44,11 @@ impl DockerTagsFetcher for RegistryTagsFetcher {
|
||||
None => { results.push(format!("Image not found: {}/{}", namespace, repository)); }
|
||||
}
|
||||
};
|
||||
if args.name.is_some() {
|
||||
let pat = args.name.clone().unwrap();
|
||||
results = results.into_iter().filter(|x| x.contains(&pat))
|
||||
.collect::<Vec<String>>();
|
||||
};
|
||||
results
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user