Skip to content

Commit

Permalink
doc: detail a bit more add possibilities
Browse files Browse the repository at this point in the history
  • Loading branch information
mkniewallner committed Jun 19, 2022
1 parent 53374df commit 51c975d
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,18 +288,28 @@ poetry will choose a suitable one based on the available package versions.
poetry add requests pendulum
```

You also can specify a constraint when adding a package, like so:
You can also specify a constraint when adding a package:

```bash
# Allow >=2.0.5, <3.0.0 versions
poetry add pendulum@^2.0.5

# Allow >=2.0.5, <2.1.0 versions
poetry add pendulum@~2.0.5

# Allow >=2.0.5 versions, without upper bound
poetry add "pendulum>=2.0.5"
poetry add "pendulum==2.0.5"

# Allow only 2.0.5 version
poetry add pendulum==2.0.5
```

If you try to add a package that is already present, you will get an error.
However, if you specify a constraint, like above, the dependency will be updated
by using the specified constraint. If you want to get the latest version of an already
present dependency you can use the special `latest` constraint:
by using the specified constraint.

If you want to get the latest version of an already
present dependency, you can use the special `latest` constraint:

```bash
poetry add pendulum@latest
Expand All @@ -320,8 +330,7 @@ or use ssh instead of https:
```bash
poetry add git+ssh://git@github.com/sdispater/pendulum.git

or alternatively:

# or alternatively:
poetry add git+ssh://git@github.com:sdispater/pendulum.git
```

Expand All @@ -332,8 +341,7 @@ you can specify it when using `add`:
poetry add git+https://github.com/sdispater/pendulum.git#develop
poetry add git+https://github.com/sdispater/pendulum.git#2.0.5

or using SSH instead:

# or using SSH instead:
poetry add git+ssh://github.com/sdispater/pendulum.git#develop
poetry add git+ssh://github.com/sdispater/pendulum.git#2.0.5
```
Expand Down

0 comments on commit 51c975d

Please # to comment.