Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
ccfb87ae
Commit
ccfb87ae
authored
Apr 14, 2022
by
Arun Babu Neelicattu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
command options: allow for default values
parent
a514831e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
4 deletions
+22
-4
src/poetry/console/commands/add.py
+1
-1
src/poetry/console/commands/command.py
+8
-0
src/poetry/console/commands/group_command.py
+10
-0
src/poetry/console/commands/install.py
+1
-1
src/poetry/console/commands/remove.py
+2
-2
No files found.
src/poetry/console/commands/add.py
View file @
ccfb87ae
...
...
@@ -107,7 +107,7 @@ You can specify a package in the following forms:
)
group
=
"dev"
else
:
group
=
self
.
option
(
"group"
)
group
=
self
.
option
(
"group"
,
self
.
default_group
or
MAIN_GROUP
)
if
self
.
option
(
"extras"
)
and
len
(
packages
)
>
1
:
raise
ValueError
(
...
...
src/poetry/console/commands/command.py
View file @
ccfb87ae
from
__future__
import
annotations
from
typing
import
TYPE_CHECKING
from
typing
import
Any
from
cleo.commands.command
import
Command
as
BaseCommand
from
cleo.exceptions
import
ValueException
if
TYPE_CHECKING
:
...
...
@@ -30,3 +32,9 @@ class Command(BaseCommand):
def
reset_poetry
(
self
)
->
None
:
self
.
get_application
()
.
reset_poetry
()
def
option
(
self
,
name
:
str
,
default
:
Any
=
None
)
->
Any
:
try
:
return
super
()
.
option
(
name
)
except
ValueException
:
return
default
src/poetry/console/commands/group_command.py
View file @
ccfb87ae
...
...
@@ -61,6 +61,16 @@ class GroupCommand(EnvCommand):
}
@property
def
default_group
(
self
)
->
str
|
None
:
"""
The default group to use when no group is specified. This is useful
for command that have the `--group` option, eg: add, remove.
Can be overridden to adapt behavior.
"""
return
None
@property
def
default_groups
(
self
)
->
set
[
str
]:
"""
The groups that are considered by the command by default.
...
...
src/poetry/console/commands/install.py
View file @
ccfb87ae
...
...
@@ -80,7 +80,7 @@ dependencies and not including the current project, run the command with the
)
extras
=
[]
for
extra
in
self
.
option
(
"extras"
):
for
extra
in
self
.
option
(
"extras"
,
[]
):
if
" "
in
extra
:
extras
+=
[
e
.
strip
()
for
e
in
extra
.
split
(
" "
)]
else
:
...
...
src/poetry/console/commands/remove.py
View file @
ccfb87ae
...
...
@@ -48,7 +48,7 @@ list of installed packages
)
group
=
"dev"
else
:
group
=
self
.
option
(
"group"
)
group
=
self
.
option
(
"group"
,
self
.
default_group
)
content
=
self
.
poetry
.
file
.
read
()
poetry_content
=
content
[
"tool"
][
"poetry"
]
...
...
@@ -106,7 +106,7 @@ list of installed packages
self
.
poetry
.
config
.
get
(
"experimental.new-installer"
,
False
)
)
self
.
_installer
.
dry_run
(
self
.
option
(
"dry-run"
))
self
.
_installer
.
dry_run
(
self
.
option
(
"dry-run"
,
False
))
self
.
_installer
.
verbose
(
self
.
_io
.
is_verbose
())
self
.
_installer
.
update
(
True
)
self
.
_installer
.
whitelist
(
removed_set
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment