Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version #7

Merged
merged 2 commits into from
Nov 3, 2022
Merged
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- `--version` flag
### Changed
- Test system modified
- `countdown_timer` function modified
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ Simple timer for your terminal!

⚠️ You can use `mytimer` or `python -m mytimer` to run this program


### Version

```console
mytimer --version
```

### Basic

```console
Expand Down
13 changes: 8 additions & 5 deletions mytimer/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
"""mytimer main."""
from mytimer.functions import countdown_timer, countup_timer
from mytimer.functions import countdown_timer, countup_timer, MY_TIMER_VERSION
import argparse


Expand All @@ -22,15 +22,18 @@ def main():
const=1)
parser.add_argument('--countup', help='countup timer', nargs="?", const=1)
parser.add_argument('--alarm', help='alarm', nargs="?", const=1)
parser.add_argument('--version', help='version', nargs="?", const=1)
args = parser.parse_args()
for item in params:
if getattr(args, item) is not None:
params[item] = getattr(args, item)
if args.countdown:
countdown_timer(**params)
if args.version:
print(MY_TIMER_VERSION)
else:
countup_timer(**params)

if args.countdown:
countdown_timer(**params)
else:
countup_timer(**params)

if __name__ == "__main__":
main()