diff options
| author | Teddy Wing | 2018-02-04 03:56:16 +0100 |
|---|---|---|
| committer | Teddy Wing | 2018-02-04 03:56:16 +0100 |
| commit | c0a814f892ef389cc708df12d1107b0d4b8cdcea (patch) | |
| tree | bbcab040768371bd16d6d7a1fbf5f8a21b4a32ff | |
| parent | fa855bcaf06caacd610646ac0df0662e1bef4da3 (diff) | |
| download | harvester-submit-week-for-approval-c0a814f892ef389cc708df12d1107b0d4b8cdcea.tar.bz2 | |
Add command-line option parsing
Doesn't do anything but parse the arguments yet. Really liking Python's
built-in argument parser, really simple to use.
| -rw-r--r-- | harvester_submit_week_for_approval.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/harvester_submit_week_for_approval.py b/harvester_submit_week_for_approval.py index 96f63e5..10d8dd9 100644 --- a/harvester_submit_week_for_approval.py +++ b/harvester_submit_week_for_approval.py @@ -1,5 +1,6 @@ #!/usr/bin/env python +import argparse from datetime import datetime, timedelta from selenium.webdriver import Firefox @@ -80,6 +81,23 @@ def submit_week_for_approval(driver, wait): return driver if __name__ == "__main__": + parser = argparse.ArgumentParser( + description='Submit the most recent Harvest timesheet for approval.') + parser.add_argument( + '--email', + required=True, + help='Harvest email address') + parser.add_argument( + '--password-command', + required=True, + help='Shell command to get Harvest password') + parser.add_argument( + '--subdomain', + required=True, + help='Harvest subdomain (acme in acme.harvestapp.com)') + + args = parser.parse_args() + options = Options() options.add_argument('-headless') driver = Firefox( |
