Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ Syntax for a duration is `__h__m__s` where the hour, minute and second values ar
- 10hrs 5secs - `10h5s`
- 1hr 25mins 45secs - `1h25m45s`

### Updated examples

- 2min 40mins - `165m`
- 10hrs 50 mins - `650m`
- you can do 999h or 999s as well

### Options

#### --no-bell
Expand Down
3 changes: 2 additions & 1 deletion timer/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def createTimeString(hrs: Number, mins: Number, secs: Number) -> str:
def parseDurationString(
duration_str: str,
) -> Tuple[bool, Union[List[Optional[str]], str]]:
duration_regex = re.compile(r"([0-9]{1,2}h)?([0-9]{1,2}m)?([0-9]{1,2}s)?")
# Updated regex to allow more digits for hours, minutes, and seconds
duration_regex = re.compile(r"([0-9]+h)?([0-9]+m)?([0-9]+s)?")
match = duration_regex.match(duration_str)
if match and any(match.groups()):
return True, list(match.groups())
Expand Down