diff --git a/CHANGELOG.org b/CHANGELOG.org index dfbcd24..2151111 100644 --- a/CHANGELOG.org +++ b/CHANGELOG.org @@ -4,4 +4,6 @@ Added the function that gets a list of repositories from a namespace. ** 0.2.0 <2023-06-18 Sun> Added the function that gets a list of tags from a repository. +** 0.3.0 <2023-06-18 Sun> + Added the filter option for a list of tags. diff --git a/docker_tags_getter/cli/repo.py b/docker_tags_getter/cli/repo.py index 943c469..f00c234 100644 --- a/docker_tags_getter/cli/repo.py +++ b/docker_tags_getter/cli/repo.py @@ -24,6 +24,7 @@ import typer from docker_tags_getter.config.headers_config import HeadersConfig from docker_tags_getter.fetcher.api_fetcher import ApiFetcher +from docker_tags_getter.filters.tags_filter import TagsFilter from docker_tags_getter.api.v2.repositories_api import RepositoriesAPI from docker_tags_getter.api.v2.tags_api import TagsAPI @@ -42,6 +43,11 @@ def tags( help="[b]The repository[/] is a uniq identification of [b]a project[/].", show_default=False ), + filter: bool = typer.Option( + None, "--filter", "-f", + help="[b]The tags[/] will be filtered.", + show_default=False + ), ): """ [green b]All tags[/] will be returned for the [yellow b]namespace[/]. @@ -61,6 +67,13 @@ def tags( tags = tags_api.get_list() + if filter: + if 'latest' in tags: + tags.remove('latest') + + tags_filter = TagsFilter() + tags = tags_filter.filter_list(tags) + for tag in tags: console.print(tag) diff --git a/pyproject.toml b/pyproject.toml index b26cb94..43ba340 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "docker-tags-getter" -version = "0.2.0" +version = "0.3.0" description = "" authors = ["Kostiantyn Klochko "] readme = "README.rst"