Skip to content

Commit

Permalink
BugFix: Campsite Searching in YAML (#59)
Browse files Browse the repository at this point in the history
* --campsites -> YAML

* Sphinx Documentation

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
juftin and github-actions[bot] authored Jan 28, 2022
1 parent 7ad7878 commit defb4b7
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 34 deletions.
29 changes: 15 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -460,20 +460,21 @@ Sometimes, using a YAML configuration file is easier to manage all of your searc
below [YML example file](docs/examples/example_search.yml) and corresponding camply command:

```yaml
provider: RecreationDotGov # RecreationDotGov IF NOT PROVIDED
recreation_area: # (LIST OR SINGLE ENTRY)
- 2991 # Yosemite National Park, CA (All Campgrounds)
- 1074 # Sierra National Forest, CA (All Campgrounds)
campgrounds: null # ENTIRE FIELD CAN BE OMITTED IF NOT USED. # (LIST OR SINGLE ENTRY)
start_date: 2022-09-12 # YYYY-MM-DD
end_date: 2022-09-13 # YYYY-MM-DD
weekends: False # FALSE BY DEFAULT
nights: 1 # 1 BY DEFAULT
continuous: True # DEFAULTS TO TRUE
polling_interval: 5 # DEFAULTS TO 10 , CAN'T BE LESS THAN 5
notifications: email # (silent, email, pushover, pushbullet), DEFAULTS TO `silent`
search_forever: True # FALSE BY DEFAULT
notify_first_try: False # FALSE BY DEFAULT
provider: RecreationDotGov # RecreationDotGov IF NOT PROVIDED
recreation_area: # (LIST OR SINGLE ENTRY)
- 2991 # Yosemite National Park, CA (All Campgrounds)
- 1074 # Sierra National Forest, CA (All Campgrounds)
campgrounds: null # ENTIRE FIELD CAN BE OMITTED IF NOT USED - (LIST OR SINGLE ENTRY)
campsites: null # OVERRIDES CAMPGROUNDS / RECREATION AREA - (LIST OR SINGLE ENTRY)
start_date: 2022-09-12 # YYYY-MM-DD
end_date: 2022-09-13 # YYYY-MM-DD
weekends: false # FALSE BY DEFAULT
nights: 1 # 1 BY DEFAULT
continuous: true # DEFAULTS TO TRUE
polling_interval: 5 # DEFAULTS TO 10 , CAN'T BE LESS THAN 5
notifications: email # (silent, email, pushover, pushbullet), DEFAULTS TO `silent`
search_forever: true # FALSE BY DEFAULT
notify_first_try: false # FALSE BY DEFAULT
```
```shell
Expand Down
2 changes: 1 addition & 1 deletion camply/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
camply __version__ file
"""

__version__ = "0.2.1"
__version__ = "0.2.2"
__camply__ = "camply"
2 changes: 2 additions & 0 deletions camply/utils/yaml_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ def yaml_file_to_arguments(file_path: str) -> Tuple[str, Dict[str, object], Dict
nights = int(yaml_search.get("nights", 1))
recreation_area = yaml_search.get("recreation_area", None)
campgrounds = yaml_search.get("campgrounds", None)
campsites = yaml_search.get("campsites", None)
weekends_only = yaml_search.get("weekends", False)
continuous = yaml_search.get("continuous", True)
polling_interval = yaml_search.get("polling_interval",
Expand All @@ -110,6 +111,7 @@ def yaml_file_to_arguments(file_path: str) -> Tuple[str, Dict[str, object], Dict
provider_kwargs = dict(search_window=search_window,
recreation_area=recreation_area,
campgrounds=campgrounds,
campsites=campsites,
weekends_only=weekends_only,
nights=nights)
search_kwargs = dict(
Expand Down
11 changes: 6 additions & 5 deletions docs/examples/example_search.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
provider: RecreationDotGov # RecreationDotGov IF NOT PROVIDED
recreation_area: # (LIST OR SINGLE ENTRY)
- 2991 # Yosemite National Park, CA (All Campgrounds)
- 1074 # Sierra National Forest, CA (All Campgrounds)
campgrounds: null # OVERRIDES RECREATION AREA (LIST OR SINGLE ENTRY)
- 2991 # Yosemite National Park, CA (All Campgrounds)
- 1074 # Sierra National Forest, CA (All Campgrounds)
campgrounds: null # ENTIRE FIELD CAN BE OMITTED IF NOT USED - (LIST OR SINGLE ENTRY)
campsites: null # OVERRIDES CAMPGROUNDS / RECREATION AREA - (LIST OR SINGLE ENTRY)
start_date: 2022-09-12 # YYYY-MM-DD
end_date: 2022-09-13 # YYYY-MM-DD
weekends: false # FALSE BY DEFAULT
nights: 1 # 1 BY DEFAULT
continuous: false # DEFAULTS TO TRUE
continuous: true # DEFAULTS TO TRUE
polling_interval: 5 # DEFAULTS TO 10 , CAN'T BE LESS THAN 5
notifications: email # (silent, email, pushover, pushbullet), DEFAULTS TO `silent`. LIST OR SINGLE ENTRY
notifications: email # (silent, email, pushover, pushbullet), DEFAULTS TO `silent`
search_forever: true # FALSE BY DEFAULT
notify_first_try: false # FALSE BY DEFAULT
29 changes: 15 additions & 14 deletions docs/source/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,20 +459,21 @@ Sometimes, using a YAML configuration file is easier to manage all of your searc
below [YML example file](docs/examples/example_search.yml) and corresponding camply command:

```yaml
provider: RecreationDotGov # RecreationDotGov IF NOT PROVIDED
recreation_area: # (LIST OR SINGLE ENTRY)
- 2991 # Yosemite National Park, CA (All Campgrounds)
- 1074 # Sierra National Forest, CA (All Campgrounds)
campgrounds: null # ENTIRE FIELD CAN BE OMITTED IF NOT USED. # (LIST OR SINGLE ENTRY)
start_date: 2022-09-12 # YYYY-MM-DD
end_date: 2022-09-13 # YYYY-MM-DD
weekends: False # FALSE BY DEFAULT
nights: 1 # 1 BY DEFAULT
continuous: True # DEFAULTS TO TRUE
polling_interval: 5 # DEFAULTS TO 10 , CAN'T BE LESS THAN 5
notifications: email # (silent, email, pushover, pushbullet), DEFAULTS TO `silent`
search_forever: True # FALSE BY DEFAULT
notify_first_try: False # FALSE BY DEFAULT
provider: RecreationDotGov # RecreationDotGov IF NOT PROVIDED
recreation_area: # (LIST OR SINGLE ENTRY)
- 2991 # Yosemite National Park, CA (All Campgrounds)
- 1074 # Sierra National Forest, CA (All Campgrounds)
campgrounds: null # ENTIRE FIELD CAN BE OMITTED IF NOT USED - (LIST OR SINGLE ENTRY)
campsites: null # OVERRIDES CAMPGROUNDS / RECREATION AREA - (LIST OR SINGLE ENTRY)
start_date: 2022-09-12 # YYYY-MM-DD
end_date: 2022-09-13 # YYYY-MM-DD
weekends: false # FALSE BY DEFAULT
nights: 1 # 1 BY DEFAULT
continuous: true # DEFAULTS TO TRUE
polling_interval: 5 # DEFAULTS TO 10 , CAN'T BE LESS THAN 5
notifications: email # (silent, email, pushover, pushbullet), DEFAULTS TO `silent`
search_forever: true # FALSE BY DEFAULT
notify_first_try: false # FALSE BY DEFAULT
```
```shell
Expand Down
1 change: 1 addition & 0 deletions tests/command_line_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ camply campsites --campground 232045 --start-date 2022-07-15 --end-date 2022-10-
camply campsites --provider yellowstone --start-date 2022-10-10 --end-date 2022-10-16
camply campsites --campsite 40107 --start-date 2022-09-15 --end-date 2022-09-17
camply campgrounds --campsite 40107
camply campsites --yml-config tests/yml/example_campsite_search.yml
10 changes: 10 additions & 0 deletions tests/yml/example_campsite_search.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
provider: RecreationDotGov # RecreationDotGov IF NOT PROVIDED
recreation_area: # (LIST OR SINGLE ENTRY)
- 2907 # ROCKY MOUNTAIN NATIONAL PARK
campsites:
- 40107
- 177
start_date: 2022-09-10 # YYYY-MM-DD
end_date: 2022-09-11 # YYYY-MM-DD
weekends: false # FALSE BY DEFAULT
continuous: false # DEFAULTS TO TRUE

0 comments on commit defb4b7

Please sign in to comment.