Skip to content

Commit

Permalink
v.0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mebaysan committed Oct 7, 2022
1 parent 4e97dd3 commit 92cbfdd
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 9 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
- [Installation](#installation)
- [Install As a Bash Script](#install-as-a-bash-script)
- [Usage](#usage)
- [translate](#translate)
- [sentence](#sentence)
- [Error Handling](#error-handling)
- [Help about parameters](#help-about-parameters)

Expand Down Expand Up @@ -32,6 +34,8 @@ Or you can just use `sudo make install`.

If you want to use it from bash, you can just move [tureng-cli.sh](tureng-cli.sh) to `/usr/sbin/`.

**!With this kind of installation, you can use `translate` command for default.**

```
>>> sudo mv tureng-cli.sh /usr/sbin/
>>> turenh-cli.sh "hurricane"
Expand All @@ -57,6 +61,10 @@ Meanings of "hurricane" in Turkish English Dictionary : 15 result(s)

# Usage

## translate

This command is using for translating words.

There are basically 2 parameters by using the CLI:
- `-w` or `--word` for words to translate in both language Turkish or English
- `-n` or `--n-results` to limit the result of the translation rows
Expand Down Expand Up @@ -101,6 +109,34 @@ Meanings of "hurricane" in Turkish English Dictionary : 15 result(s)
```

## sentence

This command is using for showing sentence examples.

There are basically 2 parameters by using the CLI:
- `-w` or `--word` for words to translate in both language Turkish or English
- `-n` or `--n-results` to limit the result of the translation rows

The example below is for Turkish -> English.

```
>>> python -m tureng_cli sentence -w "Hurricane" -n 10
Hurricane sentence example
# Sentence
1 + Oh, and the tropical storm will become a hurricane late Saturday night.
2 + The town was considerably damaged by the great hurricane of the 8th of August 1899.
3 + He'd managed to miss the hurricane, though the waters were still rough and the waves high.
4 + Everything needs to be ready, especially if the hurricane shifts to make landfall.
5 + In 1907 a hurricane destroyed the greater part of the laurels of the Prado and the royal palms of the Parque de Colon.
6 + He felt like he'd been hit by a hurricane.
7 + In 1090 a tremendous hurricane passed over London, and blew down six hundred houses and many churches.
8 + An open space forming the heart of the square in which the church stands separates the solitary western tower (14th century) from the choir and transept, the nave having been blown down by a violent hurricane in 1674 and never rebuilt.
9 + In July, on the approach of the dangerous hurricane season, Rodney sailed for North America, reaching New York on the 14th of September.
10 + The hurricane, too, was followed by repeated droughts, and the inhabitants of the out-islands were reduced to indigence and want, a condition which is still, in some measure, in evidence.
```

## Error Handling

```
Expand Down
4 changes: 2 additions & 2 deletions tureng_cli/__main__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import click
from tureng_cli.utilities.helpers import bind_commands_to_cli
from tureng_cli.commands.translate import translate
from tureng_cli.commands.sentence import sentence

Expand All @@ -9,5 +8,6 @@ def cli():
pass


bind_commands_to_cli(cli, [sentence])
cli.add_command(translate)
cli.add_command(sentence)
cli()
4 changes: 2 additions & 2 deletions tureng_cli/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import click
from tureng_cli.utilities.helpers import bind_commands_to_cli
from tureng_cli.commands.translate import translate
from tureng_cli.commands.sentence import sentence

Expand All @@ -10,5 +9,6 @@ def cli():


if __name__ == "__main__":
bind_commands_to_cli(cli, [sentence])
cli.add_command(translate)
cli.add_command(sentence)
cli()
5 changes: 0 additions & 5 deletions tureng_cli/utilities/helpers.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
from .constants import BASE_URL_TR,SENTENCE_URL_EN


def bind_commands_to_cli(cli, *args, **kwargs):
for func in args:
cli.add_command(*func)


def get_turkish_translate_url(word):
return BASE_URL_TR + word

Expand Down

0 comments on commit 92cbfdd

Please sign in to comment.