prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  --short has no effect when `poetry version` is passed a new version
  <!--
    Hi there! Thank you for discovering and submitting an issue.
  
    Before you submit this; let's make sure of a few things.
    Please make sure the following boxes are ticked if they are correct.
    If not, please try and fulfill these first.
  -->
  
  <!-- Checked checkbox should look like this: [x] -->
  - [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.
  - [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.
  - [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).
  
  <!--
    Once those are done, if you're able to fill in the following list with your information,
    it'd be very helpful to whoever handles the issue.
  -->
  
  - **OS version and name**: Ubuntu 16.04
  - **Poetry version**: 1.1.4
  - **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: n/a
  
  ## Issue
  <!-- Now feel free to write your issue, but please be descriptive! Thanks again 🙌 ❤️ -->
  
  Hi there!
  
  Assuming the current version of a project is 0.1.0, this is what happens when trying to update to the next patch version with the `--short` option:
  
  ```console
  $ poetry version patch --short
  Bumping version from 0.1.0 to 0.1.1
  ```
  
  Instead, I would like this to be output (only the new version number):
  
  ```console
  $ poetry version patch --short
  0.1.1
  ```
  
  My use case is scripting: if the user only provides a bump rule to my script, I'd like to be able to easily parse the new version computed by poetry so that I can e.g. create a new git tag easily, and so on.
  
  Thanks!
  
  </issue>
  <code>
  [start of poetry/console/commands/version.py]
  1 from cleo import argument
  2 from cleo import option
  3 
  4 from .command import Command
  5 
  6 
  7 class VersionCommand(Command):
  8 
  9     name = "version"
  10     description = (
  11         "Shows the version of the project or bumps it when a valid "
  12         "bump rule is provided."
  13     )
  14 
  15     arguments = [
  16         argument(
  17             "version",
  18             "The version number or the rule to update the version.",
  19             optional=True,
  20         )
  21     ]
  22     options = [option("short", "s", "Output the version number only")]
  23 
  24     help = """\
  25 The version command shows the current version of the project or bumps the version of
  26 the project and writes the new version back to <comment>pyproject.toml</> if a valid
  27 bump rule is provided.
  28 
  29 The new version should ideally be a valid semver string or a valid bump rule:
  30 patch, minor, major, prepatch, preminor, premajor, prerelease.
  31 """
  32 
  33     RESERVED = {
  34         "major",
  35         "minor",
  36         "patch",
  37         "premajor",
  38         "preminor",
  39         "prepatch",
  40         "prerelease",
  41     }
  42 
  43     def handle(self):
  44         version = self.argument("version")
  45 
  46         if version:
  47             version = self.increment_version(
  48                 self.poetry.package.pretty_version, version
  49             )
  50 
  51             self.line(
  52                 "Bumping version from <b>{}</> to <fg=green>{}</>".format(
  53                     self.poetry.package.pretty_version, version
  54                 )
  55             )
  56 
  57             content = self.poetry.file.read()
  58             poetry_content = content["tool"]["poetry"]
  59             poetry_content["version"] = version.text
  60 
  61             self.poetry.file.write(content)
  62         else:
  63             if self.option("short"):
  64                 self.line("{}".format(self.poetry.package.pretty_version))
  65             else:
  66                 self.line(
  67                     "<comment>{}</> <info>{}</>".format(
  68                         self.poetry.package.name, self.poetry.package.pretty_version
  69                     )
  70                 )
  71 
  72     def increment_version(self, version, rule):
  73         from poetry.core.semver import Version
  74 
  75         try:
  76             version = Version.parse(version)
  77         except ValueError:
  78             raise ValueError("The project's version doesn't seem to follow semver")
  79 
  80         if rule in {"major", "premajor"}:
  81             new = version.next_major
  82             if rule == "premajor":
  83                 new = new.first_prerelease
  84         elif rule in {"minor", "preminor"}:
  85             new = version.next_minor
  86             if rule == "preminor":
  87                 new = new.first_prerelease
  88         elif rule in {"patch", "prepatch"}:
  89             new = version.next_patch
  90             if rule == "prepatch":
  91                 new = new.first_prerelease
  92         elif rule == "prerelease":
  93             if version.is_prerelease():
  94                 pre = version.prerelease
  95                 new_prerelease = int(pre[1]) + 1
  96                 new = Version.parse(
  97                     "{}.{}.{}-{}".format(
  98                         version.major,
  99                         version.minor,
  100                         version.patch,
  101                         ".".join([pre[0], str(new_prerelease)]),
  102                     )
  103                 )
  104             else:
  105                 new = version.next_patch.first_prerelease
  106         else:
  107             new = Version.parse(rule)
  108 
  109         return new
  110
  [end of poetry/console/commands/version.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/poetry/console/commands/version.py b/poetry/console/commands/version.py
  --- a/poetry/console/commands/version.py
  +++ b/poetry/console/commands/version.py
  @@ -48,11 +48,14 @@
                   self.poetry.package.pretty_version, version
               )
   
  -            self.line(
  -                "Bumping version from <b>{}</> to <fg=green>{}</>".format(
  -                    self.poetry.package.pretty_version, version
  +            if self.option("short"):
  +                self.line("{}".format(version))
  +            else:
  +                self.line(
  +                    "Bumping version from <b>{}</> to <fg=green>{}</>".format(
  +                        self.poetry.package.pretty_version, version
  +                    )
                   )
  -            )
   
               content = self.poetry.file.read()
               poetry_content = content["tool"]["poetry"]
  
verification_info: {"golden_diff": "diff --git a/poetry/console/commands/version.py b/poetry/console/commands/version.py\n--- a/poetry/console/commands/version.py\n+++ b/poetry/console/commands/version.py\n@@ -48,11 +48,14 @@\n                 self.poetry.package.pretty_version, version\n             )\n \n-            self.line(\n-                \"Bumping version from <b>{}</> to <fg=green>{}</>\".format(\n-                    self.poetry.package.pretty_version, version\n+            if self.option(\"short\"):\n+                self.line(\"{}\".format(version))\n+            else:\n+                self.line(\n+                    \"Bumping version from <b>{}</> to <fg=green>{}</>\".format(\n+                        self.poetry.package.pretty_version, version\n+                    )\n                 )\n-            )\n \n             content = self.poetry.file.read()\n             poetry_content = content[\"tool\"][\"poetry\"]\n", "issue": "--short has no effect when `poetry version` is passed a new version\n<!--\r\n  Hi there! Thank you for discovering and submitting an issue.\r\n\r\n  Before you submit this; let's make sure of a few things.\r\n  Please make sure the following boxes are ticked if they are correct.\r\n  If not, please try and fulfill these first.\r\n-->\r\n\r\n<!-- Checked checkbox should look like this: [x] -->\r\n- [x] I am on the [latest](https://github.com/python-poetry/poetry/releases/latest) Poetry version.\r\n- [x] I have searched the [issues](https://github.com/python-poetry/poetry/issues) of this repo and believe that this is not a duplicate.\r\n- [x] If an exception occurs when executing a command, I executed it again in debug mode (`-vvv` option).\r\n\r\n<!--\r\n  Once those are done, if you're able to fill in the following list with your information,\r\n  it'd be very helpful to whoever handles the issue.\r\n-->\r\n\r\n- **OS version and name**: Ubuntu 16.04\r\n- **Poetry version**: 1.1.4\r\n- **Link of a [Gist](https://gist.github.com/) with the contents of your pyproject.toml file**: n/a\r\n\r\n## Issue\r\n<!-- Now feel free to write your issue, but please be descriptive! Thanks again \ud83d\ude4c \u2764\ufe0f -->\r\n\r\nHi there!\r\n\r\nAssuming the current version of a project is 0.1.0, this is what happens when trying to update to the next patch version with the `--short` option:\r\n\r\n```console\r\n$ poetry version patch --short\r\nBumping version from 0.1.0 to 0.1.1\r\n```\r\n\r\nInstead, I would like this to be output (only the new version number):\r\n\r\n```console\r\n$ poetry version patch --short\r\n0.1.1\r\n```\r\n\r\nMy use case is scripting: if the user only provides a bump rule to my script, I'd like to be able to easily parse the new version computed by poetry so that I can e.g. create a new git tag easily, and so on.\r\n\r\nThanks!\n", "before_files": [{"content": "from cleo import argument\nfrom cleo import option\n\nfrom .command import Command\n\n\nclass VersionCommand(Command):\n\n    name = \"version\"\n    description = (\n        \"Shows the version of the project or bumps it when a valid \"\n        \"bump rule is provided.\"\n    )\n\n    arguments = [\n        argument(\n            \"version\",\n            \"The version number or the rule to update the version.\",\n            optional=True,\n        )\n    ]\n    options = [option(\"short\", \"s\", \"Output the version number only\")]\n\n    help = \"\"\"\\\nThe version command shows the current version of the project or bumps the version of\nthe project and writes the new version back to <comment>pyproject.toml</> if a valid\nbump rule is provided.\n\nThe new version should ideally be a valid semver string or a valid bump rule:\npatch, minor, major, prepatch, preminor, premajor, prerelease.\n\"\"\"\n\n    RESERVED = {\n        \"major\",\n        \"minor\",\n        \"patch\",\n        \"premajor\",\n        \"preminor\",\n        \"prepatch\",\n        \"prerelease\",\n    }\n\n    def handle(self):\n        version = self.argument(\"version\")\n\n        if version:\n            version = self.increment_version(\n                self.poetry.package.pretty_version, version\n            )\n\n            self.line(\n                \"Bumping version from <b>{}</> to <fg=green>{}</>\".format(\n                    self.poetry.package.pretty_version, version\n                )\n            )\n\n            content = self.poetry.file.read()\n            poetry_content = content[\"tool\"][\"poetry\"]\n            poetry_content[\"version\"] = version.text\n\n            self.poetry.file.write(content)\n        else:\n            if self.option(\"short\"):\n                self.line(\"{}\".format(self.poetry.package.pretty_version))\n            else:\n                self.line(\n                    \"<comment>{}</> <info>{}</>\".format(\n                        self.poetry.package.name, self.poetry.package.pretty_version\n                    )\n                )\n\n    def increment_version(self, version, rule):\n        from poetry.core.semver import Version\n\n        try:\n            version = Version.parse(version)\n        except ValueError:\n            raise ValueError(\"The project's version doesn't seem to follow semver\")\n\n        if rule in {\"major\", \"premajor\"}:\n            new = version.next_major\n            if rule == \"premajor\":\n                new = new.first_prerelease\n        elif rule in {\"minor\", \"preminor\"}:\n            new = version.next_minor\n            if rule == \"preminor\":\n                new = new.first_prerelease\n        elif rule in {\"patch\", \"prepatch\"}:\n            new = version.next_patch\n            if rule == \"prepatch\":\n                new = new.first_prerelease\n        elif rule == \"prerelease\":\n            if version.is_prerelease():\n                pre = version.prerelease\n                new_prerelease = int(pre[1]) + 1\n                new = Version.parse(\n                    \"{}.{}.{}-{}\".format(\n                        version.major,\n                        version.minor,\n                        version.patch,\n                        \".\".join([pre[0], str(new_prerelease)]),\n                    )\n                )\n            else:\n                new = version.next_patch.first_prerelease\n        else:\n            new = Version.parse(rule)\n\n        return new\n", "path": "poetry/console/commands/version.py"}]}