Преглед изворни кода

Parameter renamings, default start date to today

pull/287/head
nicfb пре 1 година
родитељ
комит
16cbbb6db6
2 измењених фајлова са 9 додато и 9 уклоњено
  1. +8
    -8
      kosmorro/__main__.py
  2. +1
    -1
      kosmorro/exceptions.py

+ 8
- 8
kosmorro/__main__.py Прегледај датотеку

@@ -120,7 +120,7 @@ def run():
output = get_search_information(
args.search,
args.from_,
args.to,
args.until,
timezone,
output_format,
use_colors,
@@ -245,20 +245,20 @@ def get_information(
def get_search_information(
requested_events: [EventType],
search_from: date,
search_to: date,
search_until: date,
timezone: int,
output_format: str,
colors: bool,
show_graph: bool,
) -> dumper.Dumper:
try:
if search_from is None or search_to is None:
if search_until is None:
raise SearchDatesNotGivenError

event_types = [EventType[event.upper()] for event in requested_events]
from_ = parse_date(search_from)
to = parse_date(search_to)
events_list = search_events(event_types, to, from_, timezone)
until = parse_date(search_until)
events_list = search_events(event_types, until, from_, timezone)

return get_dumpers()[output_format](
ephemerides=[],
@@ -398,11 +398,11 @@ def get_args(output_formats: [str]):
"--from",
dest="from_",
type=str,
default=None,
help=_("The date to begin searching for events."),
default=today.strftime("%Y-%m-%d"),
help=_("The date to begin searching for events. Default is today."),
)
parser.add_argument(
"--to", type=str, default=None, help=_("The date to end searching for events.")
"--until", type=str, default=None, help=_("The date to end searching for events.")
)
parser.add_argument(
"--no-colors",


+ 1
- 1
kosmorro/exceptions.py Прегледај датотеку

@@ -70,7 +70,7 @@ class SearchDatesNotGivenError(RuntimeError):
def __init__(self):
super().__init__()
self.msg = _(
"Both 'from' and 'to' dates are required when searching for events."
"Search end date (--until) is required when searching events.'"
)




Loading…
Откажи
Сачувај