Skip to content

Commit 51c975d

Browse files
committed
doc: detail a bit more add possibilities
1 parent 53374df commit 51c975d

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

docs/cli.md

+16-8
Original file line numberDiff line numberDiff line change
@@ -288,18 +288,28 @@ poetry will choose a suitable one based on the available package versions.
288288
poetry add requests pendulum
289289
```
290290

291-
You also can specify a constraint when adding a package, like so:
291+
You can also specify a constraint when adding a package:
292292

293293
```bash
294+
# Allow >=2.0.5, <3.0.0 versions
294295
poetry add pendulum@^2.0.5
296+
297+
# Allow >=2.0.5, <2.1.0 versions
298+
poetry add pendulum@~2.0.5
299+
300+
# Allow >=2.0.5 versions, without upper bound
295301
poetry add "pendulum>=2.0.5"
296-
poetry add "pendulum==2.0.5"
302+
303+
# Allow only 2.0.5 version
304+
poetry add pendulum==2.0.5
297305
```
298306

299307
If you try to add a package that is already present, you will get an error.
300308
However, if you specify a constraint, like above, the dependency will be updated
301-
by using the specified constraint. If you want to get the latest version of an already
302-
present dependency you can use the special `latest` constraint:
309+
by using the specified constraint.
310+
311+
If you want to get the latest version of an already
312+
present dependency, you can use the special `latest` constraint:
303313

304314
```bash
305315
poetry add pendulum@latest
@@ -320,8 +330,7 @@ or use ssh instead of https:
320330
```bash
321331
poetry add git+ssh://[email protected]/sdispater/pendulum.git
322332

323-
or alternatively:
324-
333+
# or alternatively:
325334
poetry add git+ssh://[email protected]:sdispater/pendulum.git
326335
```
327336

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

335-
or using SSH instead:
336-
344+
# or using SSH instead:
337345
poetry add git+ssh://github.com/sdispater/pendulum.git#develop
338346
poetry add git+ssh://github.com/sdispater/pendulum.git#2.0.5
339347
```

0 commit comments

Comments
 (0)