Skip to content

Commit

Permalink
fix bugs in CLI and sync with avro.py version of it
Browse files Browse the repository at this point in the history
  • Loading branch information
hitblast committed Jul 29, 2024
1 parent ef9f17c commit d10d420
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
20 changes: 8 additions & 12 deletions avnie/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
from typing import Optional

# Import third-party Python libraries.
import typer
import pyclip
import avro

import pyclip
import typer

# Setup the Typer app.
app = typer.Typer(
Expand Down Expand Up @@ -41,9 +40,6 @@ def _cli_action(

if reverse:
output = avro.reverse(text, remap_words=remap_words)
if bijoy:
output = avro.to_bijoy(output)

else:
output = avro.parse(text, remap_words=remap_words)
if bijoy:
Expand All @@ -62,8 +58,8 @@ def parse(
bijoy: bool = typer.Option(
False, "--bijoy", "-b", help="Convert the text to Bijoy layout."
),
remap_words: bool = typer.Option(
True, "--remap-words", "-r", help="Remap the words."
ignore_remap: bool = typer.Option(
False, "--ignore-remap", "-i", help="Skip remapping the words."
),
from_clipboard: bool = typer.Option(
False, "--from-clipboard", "-f", help="Get the text from the clipboard."
Expand All @@ -75,7 +71,7 @@ def parse(
_cli_action(
text,
bijoy=bijoy,
remap_words=remap_words,
remap_words=not ignore_remap,
from_clipboard=from_clipboard,
copy_on_success=copy_on_success,
)
Expand All @@ -84,8 +80,8 @@ def parse(
@app.command()
def reverse(
text: str = typer.Argument(None, help="The text to be converted."),
remap_words: bool = typer.Option(
True, "--remap-words", "-r", help="Remap the words."
ignore_remap: bool = typer.Option(
False, "--ignore-remap", "-i", help="Skip remapping the words."
),
from_clipboard: bool = typer.Option(
False, "--from-clipboard", "-f", help="Get the text from the clipboard."
Expand All @@ -96,7 +92,7 @@ def reverse(
) -> None:
_cli_action(
text,
remap_words=remap_words,
remap_words=not ignore_remap,
from_clipboard=from_clipboard,
copy_on_success=copy_on_success,
reverse=True,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[tool.poetry]
name = "avnie"
version = "2024.7.29"
version = "2024.7.30"
description = "A fast & user-friendly command-line interface (CLI) for avro.py."
authors = ["HitBlast <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit d10d420

Please sign in to comment.