Skip to content

Commit bc0a314

Browse files
committed
Fix --optional option in add command
1 parent a2f9aec commit bc0a314

2 files changed

Lines changed: 7 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- Fixed Python version retrieval inside virtualenvs.
1212
- Fixed optional dependencies being set as required in sdist.
13+
- Fixed `--optional` option in the `add` command not being used.
1314

1415

1516
## [0.6.3] - 2018-03-20

poetry/console/commands/add.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ def handle(self):
5353
parser.parse_constraints(constraint)
5454

5555
for name, constraint in requirements.items():
56+
if self.option('optional'):
57+
constraint = {
58+
'version': constraint,
59+
'optional': True
60+
}
61+
5662
poetry_content[section][name] = constraint
5763

5864
# Write new content

0 commit comments

Comments
 (0)