Skip to content

Commit

Permalink
refactor/docs: split arguments into groups
Browse files Browse the repository at this point in the history
  • Loading branch information
winstxnhdw committed Sep 16, 2023
1 parent eb5085c commit 9f67a9d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,16 @@ python transcribe.py -f ~/Downloads/audio.mp3 -t srt -o ./result.srt --cuda
```

```yaml
usage: transcribe.py [-h] [-c] -f -t -o
usage: transcribe.py [-h] [-c] -f -t -o

Transcribe a compatible audio/video file into a chosen caption file

options:
-h, --help show this help message and exit
-h, --help show this help message and exit
-c, --cuda whether to use CUDA for inference

required:
-f, --file the file path to a compatible audio/video
-t, --type the chosen caption file format
-o, --output the output file path
-c, --cuda whether to use CUDA for inference
```
8 changes: 5 additions & 3 deletions transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,11 @@ def parse_args() -> tuple[Arguments, list[str]]:
"""
parser = ArgumentParser(description='Transcribe a compatible audio/video file into a chosen caption file')
parser.add_argument('-c', '--cuda', action='store_true', help='whether to use CUDA for inference')
parser.add_argument('-f', '--file', type=str, required=True, metavar='', help='the file path to a compatible audio/video')
parser.add_argument('-t', '--type', type=str, required=True, metavar='', help='the chosen caption file format')
parser.add_argument('-o', '--output', type=str, required=True, metavar='', help='the output file path')

required_group = parser.add_argument_group('required')
required_group.add_argument('-f', '--file', type=str, required=True, metavar='', help='the file path to a compatible audio/video')
required_group.add_argument('-t', '--type', type=str, required=True, metavar='', help='the chosen caption file format')
required_group.add_argument('-o', '--output', type=str, required=True, metavar='', help='the output file path')

return parser.parse_known_args() # type: ignore

Expand Down

0 comments on commit 9f67a9d

Please sign in to comment.