-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from ML-Dev-Hub/cli_python
Cli python
- Loading branch information
Showing
6 changed files
with
135 additions
and
46 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from argparse import ArgumentParser | ||
from csv_trans.translate import translate | ||
|
||
def parse_arguments_from_cli(parser : ArgumentParser): | ||
''' | ||
Parse the arguments from the command line | ||
---------------- | ||
Parameters: | ||
parser: ArgumentParser | ||
The parser to parse the arguments from the command line | ||
---------------- | ||
Returns: | ||
parser: ArgumentParser | ||
The parser with the arguments parsed from the command line | ||
''' | ||
|
||
parser.add_argument('-f', '--file_path', type=str, required=True, help='file path') | ||
parser.add_argument('-fs', '--file_separator', type=str, default=',', required=False, help='file separator') | ||
parser.add_argument('-sl', '--source_language', type=str, required=True, help='source language') | ||
parser.add_argument('-tl', '--target_language', type=str, required=True, help='target language') | ||
return parser | ||
|
||
def main(): | ||
parser = ArgumentParser() | ||
parser = parse_arguments_from_cli(parser) | ||
args = parser.parse_args() | ||
translate(args.file_path, args.source_language, args.target_language, args.file_separator) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters