Skip to content

Commit

Permalink
Added a command that prints installed KPOps version
Browse files Browse the repository at this point in the history
  • Loading branch information
szymonsadowski3 committed Apr 26, 2023
1 parent 3b5aa5b commit 79395dc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions kpops/_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = "1.1.1"
18 changes: 18 additions & 0 deletions kpops/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
from kpops.pipeline_generator.pipeline import Pipeline
from kpops.utils.gen_schema import SchemaScope, gen_config_schema, gen_pipeline_schema

from .._version import __version__

if TYPE_CHECKING:
from kpops.components.base_components import PipelineComponent

Expand Down Expand Up @@ -91,6 +93,12 @@
log = logging.getLogger("")


def version_callback(value: bool):
if value:
typer.echo(f"Kpops CLI Version: {__version__}")
raise typer.Exit()


def setup_pipeline(
pipeline_base_dir: Path,
pipeline_path: Path,
Expand Down Expand Up @@ -345,5 +353,15 @@ def clean(
component.clean(dry_run)


@app.callback()
def main(
version: bool = typer.Option(
None, "--version", callback=version_callback, is_eager=True
),
):
log.debug(f"Version option called: {version}")
return


if __name__ == "__main__":
app()

0 comments on commit 79395dc

Please sign in to comment.