parent
928afd6549
commit
7f8c776eb3
@ -1,8 +1,10 @@
|
||||
from rich.console import Console
|
||||
import typer
|
||||
from docker_tags_getter.cli.repos import repos
|
||||
from docker_tags_getter.cli.repo import repo
|
||||
|
||||
console = Console()
|
||||
cli_app = typer.Typer(rich_markup_mode="rich")
|
||||
cli_app.add_typer(repos, name="repos", help="Manage repos information")
|
||||
cli_app.add_typer(repo, name="repo", help="Manage repo information")
|
||||
|
||||
|
@ -0,0 +1,64 @@
|
||||
################################################################################
|
||||
# Copyright (C) 2023 Kostiantyn Klochko <kklochko@protonmail.com> #
|
||||
# #
|
||||
# This file is part of docker_tags_getter. #
|
||||
# #
|
||||
# docker_tags_getter is free software: you can redistribute it and/or modify #
|
||||
# it under the terms of the GNU Lesser General Public License as published by #
|
||||
# the Free Software Foundation, either version 3 of the License, or (at your #
|
||||
# option) any later version. #
|
||||
# #
|
||||
# docker_tags_getter is distributed in the hope that it will be useful, but #
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY #
|
||||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public #
|
||||
# License for more details. #
|
||||
# #
|
||||
# You should have received a copy of the GNU Lesser General Public License #
|
||||
#along with docker_tags_getter. If not, see <https://www.gnu.org/licenses/>. #
|
||||
################################################################################
|
||||
|
||||
from rich.console import Console
|
||||
from rich.prompt import Prompt
|
||||
from typing import List, Optional
|
||||
import typer
|
||||
|
||||
from docker_tags_getter.config.headers_config import HeadersConfig
|
||||
from docker_tags_getter.fetcher.api_fetcher import ApiFetcher
|
||||
from docker_tags_getter.api.v2.repositories_api import RepositoriesAPI
|
||||
from docker_tags_getter.api.v2.tags_api import TagsAPI
|
||||
|
||||
console = Console()
|
||||
repo = typer.Typer()
|
||||
|
||||
@repo.command()
|
||||
def tags(
|
||||
namespace: str = typer.Option(
|
||||
None, "--namespace", "-ns",
|
||||
help="[b]The namespace[/] is a uniq identification of [b]a user or a organisation[/].",
|
||||
show_default=False
|
||||
),
|
||||
repository: str = typer.Option(
|
||||
None, "--repository", "-r",
|
||||
help="[b]The repository[/] is a uniq identification of [b]a project[/].",
|
||||
show_default=False
|
||||
),
|
||||
):
|
||||
"""
|
||||
[green b]All tags[/] will be returned for the [yellow b]namespace[/].
|
||||
"""
|
||||
if namespace is None:
|
||||
console.print(f"[red b][ERROR] Please, give the namespace name!!![/]")
|
||||
|
||||
if namespace is None:
|
||||
console.print(f"[red b][ERROR] Please, give the repository name!!![/]")
|
||||
|
||||
headers_config = HeadersConfig()
|
||||
fetcher = ApiFetcher(headers_config)
|
||||
|
||||
tags_api = TagsAPI(fetcher, namespace, repository)
|
||||
|
||||
tags = tags_api.get_list()
|
||||
|
||||
for tag in tags:
|
||||
console.print(tag)
|
||||
|
Loading…
Reference in new issue