From abfc3f3f38b2ec9359103e39183b1221bd8c77b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Eustace?= Date: Fri, 12 Jul 2019 12:15:53 +0200 Subject: [PATCH] Update documentation for the add command --- docs/docs/cli.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/docs/cli.md b/docs/docs/cli.md index 8469c2a2bba..75aa2f922c2 100644 --- a/docs/docs/cli.md +++ b/docs/docs/cli.md @@ -182,12 +182,35 @@ 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: + +```bash +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: + +```bash +poetry add pendulum@latest +``` + You can also add `git` dependencies: ```bash poetry add git+https://github.com/sdispater/pendulum.git ``` +If you need to checkout a specific branch, tag or revision, +you can specify it when using `add`: + +```bash +poetry add git+https://github.com/sdispater/pendulum.git@develop +poetry add git+https://github.com/sdispater/pendulum.git@2.0.5 +``` + or make them point to a local directory or file: ```bash