Skip to content

Commit

Permalink
fixed version option in CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddhesh-Agarwal committed May 14, 2024
1 parent 96d8252 commit 616004a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions cryptmoji/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from typing import Annotated
from rich.console import Console
from typer import Typer, prompt
from typer import Typer, prompt, Option

from cryptmoji.main import decrypt, encrypt
from cryptmoji.version import __version__
Expand All @@ -22,11 +23,13 @@ def cli_decrypt(text: str):
console.print(decrypt(text, key=key))


@app.command("--version")
def cli_version():
def cli_version(
show_version: Annotated[bool, Option("--version", "-v", is_eager=True)]
):
"""Prints the version of the library."""
version = ".".join(str(i) for i in __version__)
console.print(f"cryptmoji v{version}")
if show_version:
console.print(f"cryptmoji v{version}")


if __name__ == "__main__":
Expand Down

0 comments on commit 616004a

Please sign in to comment.