prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Set flow labels through the CLI register command
  ## Current behavior
  Right now there is no way to add a label to a **flow** when registering it using the CLI. You only can set the label from inside the flow's code.
  
  ## Proposed behavior
  It would be really nice to have a `--label` parameter (just like the one we have for agents) that would allow us to add labels on the fly when registering a flow from the CLI.
  
  ## Example
  Adding the parameter would look something like this:
  `prefect register flow --file my_flow.py --name My-Flow --label my-label`
  or this:
  `prefect register flow --file my_flow.py --name My-Flow -l my-label`
  
  This could be very useful for registering flows with continuous integration depending on the environment you want to build the flow for (for example, `dev` or `prod`).
  
  Thanks a lot and keep it up!
  
  
  </issue>
  <code>
  [start of src/prefect/cli/register.py]
  1 import os
  2 
  3 import click
  4 
  5 import prefect
  6 from prefect.utilities.storage import extract_flow_from_file
  7 
  8 
  9 @click.group(hidden=True)
  10 def register():
  11     """
  12     Register flows
  13 
  14     \b
  15     Usage:
  16         $ prefect register [OBJECT]
  17 
  18     \b
  19     Arguments:
  20         flow    Register flows with a backend API
  21 
  22     \b
  23     Examples:
  24         $ prefect register flow --file my_flow.py --name My-Flow
  25     """
  26 
  27 
  28 @register.command(
  29     hidden=True,
  30     context_settings=dict(ignore_unknown_options=True, allow_extra_args=True),
  31 )
  32 @click.option(
  33     "--file",
  34     "-f",
  35     required=True,
  36     help="A file that contains a flow",
  37     hidden=True,
  38     default=None,
  39     type=click.Path(exists=True),
  40 )
  41 @click.option(
  42     "--name",
  43     "-n",
  44     required=False,
  45     help="The `flow.name` to pull out of the file provided.",
  46     hidden=True,
  47     default=None,
  48 )
  49 @click.option(
  50     "--project",
  51     "-p",
  52     required=False,
  53     help="The name of a Prefect project to register this flow.",
  54     hidden=True,
  55     default=None,
  56 )
  57 def flow(file, name, project):
  58     """
  59     Register a flow from a file. This call will pull a Flow object out of a `.py` file
  60     and call `flow.register` on it.
  61 
  62     \b
  63     Options:
  64         --file, -f      TEXT    The path to a local file which contains a flow  [required]
  65         --name, -n      TEXT    The `flow.name` to pull out of the file provided. If a name
  66                                 is not provided then the first flow object found will be registered.
  67         --project       TEXT    The name of a Prefect project to register this flow
  68 
  69     \b
  70     Examples:
  71         $ prefect register flow --file my_flow.py --name My-Flow
  72     """
  73 
  74     # Don't run extra `run` and `register` functions inside file
  75     with prefect.context({"loading_flow": True}):
  76         file_path = os.path.abspath(file)
  77         flow_obj = extract_flow_from_file(file_path=file_path, flow_name=name)
  78 
  79     flow_obj.register(project_name=project)
  80
  [end of src/prefect/cli/register.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/src/prefect/cli/register.py b/src/prefect/cli/register.py
  --- a/src/prefect/cli/register.py
  +++ b/src/prefect/cli/register.py
  @@ -54,7 +54,14 @@
       hidden=True,
       default=None,
   )
  -def flow(file, name, project):
  +@click.option(
  +    "--label",
  +    "-l",
  +    required=False,
  +    hidden=True,
  +    multiple=True,
  +)
  +def flow(file, name, project, label):
       """
       Register a flow from a file. This call will pull a Flow object out of a `.py` file
       and call `flow.register` on it.
  @@ -64,16 +71,23 @@
           --file, -f      TEXT    The path to a local file which contains a flow  [required]
           --name, -n      TEXT    The `flow.name` to pull out of the file provided. If a name
                                   is not provided then the first flow object found will be registered.
  -        --project       TEXT    The name of a Prefect project to register this flow
  +        --project, -p   TEXT    The name of a Prefect project to register this flow
  +        --label, -l     TEXT    A label to set on the flow, extending any existing labels.
  +                                Multiple labels are supported, eg. `-l label1 -l label2`.
   
       \b
       Examples:
  -        $ prefect register flow --file my_flow.py --name My-Flow
  +        $ prefect register flow --file my_flow.py --name My-Flow -l label1 -l label2
       """
   
       # Don't run extra `run` and `register` functions inside file
       with prefect.context({"loading_flow": True}):
           file_path = os.path.abspath(file)
  -        flow_obj = extract_flow_from_file(file_path=file_path, flow_name=name)
  +        flow = extract_flow_from_file(file_path=file_path, flow_name=name)
  +
  +    if getattr(flow, "run_config", None) is not None:
  +        flow.run_config.labels.update(label)
  +    else:
  +        flow.environment.labels.update(label)
   
  -    flow_obj.register(project_name=project)
  +    flow.register(project_name=project)
  
verification_info: {"golden_diff": "diff --git a/src/prefect/cli/register.py b/src/prefect/cli/register.py\n--- a/src/prefect/cli/register.py\n+++ b/src/prefect/cli/register.py\n@@ -54,7 +54,14 @@\n     hidden=True,\n     default=None,\n )\n-def flow(file, name, project):\n+@click.option(\n+    \"--label\",\n+    \"-l\",\n+    required=False,\n+    hidden=True,\n+    multiple=True,\n+)\n+def flow(file, name, project, label):\n     \"\"\"\n     Register a flow from a file. This call will pull a Flow object out of a `.py` file\n     and call `flow.register` on it.\n@@ -64,16 +71,23 @@\n         --file, -f      TEXT    The path to a local file which contains a flow  [required]\n         --name, -n      TEXT    The `flow.name` to pull out of the file provided. If a name\n                                 is not provided then the first flow object found will be registered.\n-        --project       TEXT    The name of a Prefect project to register this flow\n+        --project, -p   TEXT    The name of a Prefect project to register this flow\n+        --label, -l     TEXT    A label to set on the flow, extending any existing labels.\n+                                Multiple labels are supported, eg. `-l label1 -l label2`.\n \n     \\b\n     Examples:\n-        $ prefect register flow --file my_flow.py --name My-Flow\n+        $ prefect register flow --file my_flow.py --name My-Flow -l label1 -l label2\n     \"\"\"\n \n     # Don't run extra `run` and `register` functions inside file\n     with prefect.context({\"loading_flow\": True}):\n         file_path = os.path.abspath(file)\n-        flow_obj = extract_flow_from_file(file_path=file_path, flow_name=name)\n+        flow = extract_flow_from_file(file_path=file_path, flow_name=name)\n+\n+    if getattr(flow, \"run_config\", None) is not None:\n+        flow.run_config.labels.update(label)\n+    else:\n+        flow.environment.labels.update(label)\n \n-    flow_obj.register(project_name=project)\n+    flow.register(project_name=project)\n", "issue": "Set flow labels through the CLI register command\n## Current behavior\r\nRight now there is no way to add a label to a **flow** when registering it using the CLI. You only can set the label from inside the flow's code.\r\n\r\n## Proposed behavior\r\nIt would be really nice to have a `--label` parameter (just like the one we have for agents) that would allow us to add labels on the fly when registering a flow from the CLI.\r\n\r\n## Example\r\nAdding the parameter would look something like this:\r\n`prefect register flow --file my_flow.py --name My-Flow --label my-label`\r\nor this:\r\n`prefect register flow --file my_flow.py --name My-Flow -l my-label`\r\n\r\nThis could be very useful for registering flows with continuous integration depending on the environment you want to build the flow for (for example, `dev` or `prod`).\r\n\r\nThanks a lot and keep it up!\r\n\n", "before_files": [{"content": "import os\n\nimport click\n\nimport prefect\nfrom prefect.utilities.storage import extract_flow_from_file\n\n\n@click.group(hidden=True)\ndef register():\n    \"\"\"\n    Register flows\n\n    \\b\n    Usage:\n        $ prefect register [OBJECT]\n\n    \\b\n    Arguments:\n        flow    Register flows with a backend API\n\n    \\b\n    Examples:\n        $ prefect register flow --file my_flow.py --name My-Flow\n    \"\"\"\n\n\n@register.command(\n    hidden=True,\n    context_settings=dict(ignore_unknown_options=True, allow_extra_args=True),\n)\n@click.option(\n    \"--file\",\n    \"-f\",\n    required=True,\n    help=\"A file that contains a flow\",\n    hidden=True,\n    default=None,\n    type=click.Path(exists=True),\n)\n@click.option(\n    \"--name\",\n    \"-n\",\n    required=False,\n    help=\"The `flow.name` to pull out of the file provided.\",\n    hidden=True,\n    default=None,\n)\n@click.option(\n    \"--project\",\n    \"-p\",\n    required=False,\n    help=\"The name of a Prefect project to register this flow.\",\n    hidden=True,\n    default=None,\n)\ndef flow(file, name, project):\n    \"\"\"\n    Register a flow from a file. This call will pull a Flow object out of a `.py` file\n    and call `flow.register` on it.\n\n    \\b\n    Options:\n        --file, -f      TEXT    The path to a local file which contains a flow  [required]\n        --name, -n      TEXT    The `flow.name` to pull out of the file provided. If a name\n                                is not provided then the first flow object found will be registered.\n        --project       TEXT    The name of a Prefect project to register this flow\n\n    \\b\n    Examples:\n        $ prefect register flow --file my_flow.py --name My-Flow\n    \"\"\"\n\n    # Don't run extra `run` and `register` functions inside file\n    with prefect.context({\"loading_flow\": True}):\n        file_path = os.path.abspath(file)\n        flow_obj = extract_flow_from_file(file_path=file_path, flow_name=name)\n\n    flow_obj.register(project_name=project)\n", "path": "src/prefect/cli/register.py"}]}