Skip to content

Commit

Permalink
added new tobijoy command and optimized CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
hitblast committed Mar 31, 2024
1 parent b451289 commit 074fa0d
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions avro/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,22 @@ def main():
return print('In order to enable CLI, please install avro.py using: pip install avro.py[cli]')

# Define the command group.
@click.group()
@click.group(help='(CLI) A modern Pythonic implementation of Avro Phonetic.')
def cli():
pass

# usage: avro parse <text>
@cli.command('parse', help='Parse a given text to Bangla.')
# usage: avro parse <text> [--bijoy]
@cli.command('parse', help='Parse a given text to Bangla / Bengali.')
@click.argument('text')
def _parse(text: str):
click.echo(avro.parse(text))
@click.option('--bijoy', is_flag=True, help='Use Bijoy Keyboard format for parsing.')
def _parse(text: str, bijoy: bool = False):
click.echo((avro.parse(text) if not bijoy else avro.parse(text, bijoy=True)))

# usage: avro tobijoy <text>
@cli.command('tobijoy', help='Convert a given text to Bijoy Keyboard format.')
@click.argument('text')
def _tobijoy(text: str):
click.echo(avro.to_bijoy(text))

# usage: avro reverse <text>
@cli.command('reverse', help='Reverse a given text to English.')
Expand Down

0 comments on commit 074fa0d

Please sign in to comment.