Some improvements over init
command
#5838
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request Check List
Resolves: #2554
Few improvements over
init
command:license
validator, since it doesn't raise any error if set to empty or invalid (see the removed_validate_package
and poetry-core helper that can confirm that)requests
(valid, will search on PyPI API)requests@^2.0
(valid)requests 2.0
(valid)requests 2.0 foo
(invalid, and crashing today, as highlighted by Prevent badly-formatted dependencies from erroringpoetry init
#2554)On a non-directly related note, I was thinking that it would be nice to be able to pass validators to the different options of the command, similarly to what we can already do in
cleo
for questions.Right now, we are only able to apply the validators on interactive mode, but not when the user provides the options through the CLI.
Going even further and additionally to this, maybe adding a dedicated boolean in
option
could make it possible to automatically ask questions if an argument is not provided?That way, the validator would be on
option
, and if the user doesn't provide it through the CLI, then they are asked to provide it, without having to create the question ourselves, and with the exact same validator as foroption
.