Skip to content

Commit

Permalink
Merge pull request #212 from Crinibus/fix-argument-compare-validate
Browse files Browse the repository at this point in the history
Accept using only --all with --compare
  • Loading branch information
Crinibus authored Feb 16, 2023
2 parents f72ec48 + fbecb74 commit dc4e342
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ To visualize your data, just run main.py with the ```-v``` or ```--visualize```
- ```-c [<category> [<category> ...]]``` or ```--category [<category> [<category> ...]]``` to visualize all products in one or more categories
- ```--id [<id> [<id> ...]]``` to visualize one or more products with the specified id(s)
- ```-n [<name> [<name> ...]]``` or ```--name [<name> ...]]``` to visualize one or more products with the specified name(s)
- ```--compare``` to compare two or more products with the specified id(s), name(s) and/or category(s) on one graph. Use with ```--id```, ```--name``` and/or ```--category```
- ```--compare``` to compare two or more products with the specified id(s), name(s) and/or category(s) or all products on one graph. Use with ```--id```, ```--name```, ```--category``` and/or ```--all```

### Example graph
![](https://user-images.githubusercontent.com/57172157/171033112-908f6420-6c7a-44ef-ba67-8a4a73bbd96e.png)
Expand Down Expand Up @@ -359,7 +359,7 @@ python3 main.py -v -c <category> -utd

**Compare two products**

To compare two products on one graph, use the flag ```--compare``` with flag ```--id```, ```--name``` and/or ```--category``` , like so:
To compare two products on one graph, use the flag ```--compare``` with flag ```--id```, ```--name```, ```--category``` and/or ```--all```, like so:
```
python3 main.py -v --compare --id <id>
```
Expand All @@ -372,5 +372,8 @@ python3 main.py -v --compare --category <category>
```
python3 main.py -v --compare --id <id> --name <name> --category <category>
```
```
python3 main.py -v --compare --all
```

***OBS** when using ```--name``` or ```--category``` multiple products can be visualized*
4 changes: 2 additions & 2 deletions scraper/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,9 @@ def validate_arguments(parser: argparse.ArgumentParser) -> argparse.Namespace:
parser.error(
"When using --visualize, then one of the following is required: --all, --category, --id, --name, --compare"
)
if args.compare and not any([args.id, args.name, args.category]):
if args.compare and not any([args.id, args.name, args.category, args.all]):
parser.error(
"When using --visualize and --compare, then one of the following is required: --id, --name, --category"
"When using --visualize and --compare, then one of the following is required: --id, --name, --category, --all"
)

if args.latest_datapoint:
Expand Down

0 comments on commit dc4e342

Please sign in to comment.