Skip to content

Commit

Permalink
Added date parser
Browse files Browse the repository at this point in the history
ntlhui committed Mar 12, 2023
1 parent 2e3e7d9 commit e9a3d62
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion e4e_data_management/cli.py
Original file line number Diff line number Diff line change
@@ -9,6 +9,19 @@
from e4e_data_management.metadata import Metadata


def init_dataset_fromisoformat(token: str) -> dt.date:
"""Provides a `today` bypass for fromisoformat
Args:
token (str): User input token
Returns:
dt.date: Date object
"""
if token.lower() == 'today':
return dt.date.today()
return dt.date.fromisoformat(token)

def init_mission_cmd(**kwargs) -> None:
"""`init_mission` command line interface
@@ -214,7 +227,7 @@ def __configure_init_dataset_parser(app: DataManager, parser: argparse.ArgumentP
'--date', '-d',
help='Date of expedition (YYYY-MM-DD)',
required=True,
type=dt.date.fromisoformat)
type=init_dataset_fromisoformat)
parser.add_argument('--project', '-p',
help='Project',
required=True)

0 comments on commit e9a3d62

Please sign in to comment.