Skip to content

Commit

Permalink
Fixed wrong package name in readme. Changed option being required if …
Browse files Browse the repository at this point in the history
…there is a default (cosmetical)? Changed part of unit test for said fix.
  • Loading branch information
WyvernIXTL committed May 21, 2024
1 parent c5948ce commit e8e364d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
[![Documentation Status](https://readthedocs.org/projects/installation-instruction/badge/?version=latest)](https://installation-instruction.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://codecov.io/gh/instructions-d-installation/installation-instruction/graph/badge.svg?token=5AIH36HYG3)](https://codecov.io/gh/instructions-d-installation/installation-instruction)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Finstructions-d-installation%2Finstallation-instruction.svg?type=small)](https://app.fossa.com/projects/git%2Bgithub.com%2Finstructions-d-installation%2Finstallation-instruction?ref=badge_small)
![PyPI - Version](https://img.shields.io/pypi/v/installation-instruction)

</div>

Expand All @@ -16,22 +17,22 @@
### [pipx](https://github.com/pypa/pipx)

```
pipx install installation_instruction
pipx install installation-instruction
```


### pip

```
python -m pip install installation_instruction
python -m pip install installation-instruction
```


### installation_instruction

*(Don't try at home.)*
```yaml
name: installation_instruction
name: installation-instruction
type: object
properties:
method:
Expand All @@ -44,7 +45,7 @@ properties:
{% else %}
pipx
{% endif %}
install installation_instruction
install installation-instruction
```


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get_flags_and_options(schema: dict) -> list[Option]:
else:
option_type = SCHEMA_TO_CLICK_TYPE_MAPPING.get(option_type, click.STRING)

required = key in required_args
required = (key in required_args) and not option_default

options.append(Option(
param_decls=[option_name],
Expand Down
2 changes: 1 addition & 1 deletion tests/data/flags_options_example.schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ properties:
- Windows
- macOS
- Linux
default: Windows


packager:
title: Packager
Expand Down
6 changes: 2 additions & 4 deletions tests/test_get_flags_and_options_from_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@


from installation_instruction.get_flags_and_options_from_schema import get_flags_and_options
import click
import yaml

def test_get_flags_and_options(test_data_flags_options):
example_schema = test_data_flags_options
Expand All @@ -26,11 +24,11 @@ def test_get_flags_and_options(test_data_flags_options):
assert options[0].opts == ["--os"]
assert options[0].help == "The operating system in which the package is installed."
assert options[0].required == True
assert options[0].default == "Windows"
assert options[0].default == None

assert options[1].opts == ["--packager"]
assert options[1].help == "The package manager of your choosing."
assert options[1].required == True
assert options[1].required == False
assert options[1].default == "pip"

assert options[2].opts == ["--virtualenv"]
Expand Down

0 comments on commit e8e364d

Please sign in to comment.