prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Fish completion is not working
  Fish completion does not seem to work:
  
  ```
  $ python my_app.py -sc install=fish | source
  $ python my_app.py <TAB> string split: Unknown option “-n”
  - (line 2):                        
  string split -n ' ' $COMP_LINE
  ^                          
  in command substitution             
          called on line 0 of file -
                                  
  in function “hydra_fish_completion”
          called on standard input
                        
  in command substitution
          called on standard input
                                                                       
  
         stringstring - manipulate strings
          -                          
  
     Synopsis                        
         string escape [(-n | --no-quoted)] [--style=xxx] [STRING...]
         string join [(-q | --quiet)] SEP [STRING...]
         string length [(-q | --quiet)] [STRING...]
         string lower [(-q | --quiet)] [STRING...]
         string match [(-a | --all)] [((-e | --entire)] [(-i | --ignore-case)] [(-r | --regex)]
                      [(-n | --index)] [(-q |
  ```
  Fish completion is not working
  Fish completion does not seem to work:
  
  ```
  $ python my_app.py -sc install=fish | source
  $ python my_app.py <TAB> string split: Unknown option “-n”
  - (line 2):                        
  string split -n ' ' $COMP_LINE
  ^                          
  in command substitution             
          called on line 0 of file -
                                  
  in function “hydra_fish_completion”
          called on standard input
                        
  in command substitution
          called on standard input
                                                                       
  
         stringstring - manipulate strings
          -                          
  
     Synopsis                        
         string escape [(-n | --no-quoted)] [--style=xxx] [STRING...]
         string join [(-q | --quiet)] SEP [STRING...]
         string length [(-q | --quiet)] [STRING...]
         string lower [(-q | --quiet)] [STRING...]
         string match [(-a | --all)] [((-e | --entire)] [(-i | --ignore-case)] [(-r | --regex)]
                      [(-n | --index)] [(-q |
  ```
  
  </issue>
  <code>
  [start of hydra/_internal/core_plugins/fish_completion.py]
  1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
  2 import logging
  3 import os
  4 import sys
  5 from typing import List, Optional, Tuple
  6 
  7 from hydra.plugins.completion_plugin import CompletionPlugin
  8 
  9 log = logging.getLogger(__name__)
  10 
  11 
  12 class FishCompletion(CompletionPlugin):
  13     def install(self) -> None:
  14         script = """function hydra_fish_completion
  15     # Hydra will access COMP_LINE to generate completion candidates
  16     set -lx COMP_LINE (commandline -cp)
  17 
  18     # Find out how to call the underlying script
  19     set -l parts (string split -n ' ' $COMP_LINE)
  20     if test "$parts[1]" = "python" -o "$parts[1]" = "python3"
  21         set cmd "$parts[1] $parts[2]"
  22         if not grep -q "@hydra.main" $parts[2]
  23             return
  24         end
  25     else
  26         set cmd "$parts[1]"
  27     end
  28 
  29     # Generate candidates
  30     eval "$cmd -sc query=fish"
  31 end
  32         """
  33         output = self._get_exec()
  34         reg_cmd = []
  35         for name, cond in output:
  36             reg_cmd.append(
  37                 f"complete -c {name} {cond}-x -a '(hydra_fish_completion)'\n"
  38             )
  39         print(script)
  40         print("".join(reg_cmd))
  41 
  42     def uninstall(self) -> None:
  43         name = self._get_uninstall_exec()
  44         print(f"complete -e -c {name}")
  45         print("function hydra_fish_completion\nend")
  46 
  47     @staticmethod
  48     def provides() -> str:
  49         return "fish"
  50 
  51     def query(self, config_name: Optional[str]) -> None:
  52         line = os.environ["COMP_LINE"]
  53         line = self.strip_python_or_app_name(line)
  54         print("\n".join(self._query(config_name=config_name, line=line)))
  55 
  56     @staticmethod
  57     def help(command: str) -> str:
  58         assert command in ["install", "uninstall"]
  59         return f"{{}} -sc {command}=fish | source"
  60 
  61     @staticmethod
  62     def _get_exec() -> List[Tuple[str, str]]:
  63         # Running as an installed app (setuptools entry point)
  64         output = []
  65         # User scenario 1: python script.py
  66         name = os.path.basename(sys.executable)
  67         cond = f"-n '__fish_seen_subcommand_from {sys.argv[0]}' "
  68         output.append((name, cond))
  69 
  70         # User scenario 2: ./script.py or src/script.py or script.py
  71         name = os.path.basename(sys.argv[0])
  72         cond = ""
  73         output.append((name, cond))
  74 
  75         return output
  76 
  77     @staticmethod
  78     def _get_uninstall_exec() -> str:
  79         name = os.path.basename(sys.argv[0])
  80 
  81         return name
  82
  [end of hydra/_internal/core_plugins/fish_completion.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/hydra/_internal/core_plugins/fish_completion.py b/hydra/_internal/core_plugins/fish_completion.py
  --- a/hydra/_internal/core_plugins/fish_completion.py
  +++ b/hydra/_internal/core_plugins/fish_completion.py
  @@ -16,7 +16,7 @@
       set -lx COMP_LINE (commandline -cp)
   
       # Find out how to call the underlying script
  -    set -l parts (string split -n ' ' $COMP_LINE)
  +    set -l parts (commandline -cpo)
       if test "$parts[1]" = "python" -o "$parts[1]" = "python3"
           set cmd "$parts[1] $parts[2]"
           if not grep -q "@hydra.main" $parts[2]
  
verification_info: {"golden_diff": "diff --git a/hydra/_internal/core_plugins/fish_completion.py b/hydra/_internal/core_plugins/fish_completion.py\n--- a/hydra/_internal/core_plugins/fish_completion.py\n+++ b/hydra/_internal/core_plugins/fish_completion.py\n@@ -16,7 +16,7 @@\n     set -lx COMP_LINE (commandline -cp)\n \n     # Find out how to call the underlying script\n-    set -l parts (string split -n ' ' $COMP_LINE)\n+    set -l parts (commandline -cpo)\n     if test \"$parts[1]\" = \"python\" -o \"$parts[1]\" = \"python3\"\n         set cmd \"$parts[1] $parts[2]\"\n         if not grep -q \"@hydra.main\" $parts[2]\n", "issue": "Fish completion is not working\nFish completion does not seem to work:\r\n\r\n```\r\n$ python my_app.py -sc install=fish | source\r\n$ python my_app.py <TAB> string split: Unknown option \u201c-n\u201d\r\n- (line 2):                        \r\nstring split -n ' ' $COMP_LINE\r\n^                          \r\nin command substitution             \r\n        called on line 0 of file -\r\n                                \r\nin function \u201chydra_fish_completion\u201d\r\n        called on standard input\r\n                      \r\nin command substitution\r\n        called on standard input\r\n                                                                     \r\n\r\n       stringstring - manipulate strings\r\n        -                          \r\n\r\n   Synopsis                        \r\n       string escape [(-n | --no-quoted)] [--style=xxx] [STRING...]\r\n       string join [(-q | --quiet)] SEP [STRING...]\r\n       string length [(-q | --quiet)] [STRING...]\r\n       string lower [(-q | --quiet)] [STRING...]\r\n       string match [(-a | --all)] [((-e | --entire)] [(-i | --ignore-case)] [(-r | --regex)]\r\n                    [(-n | --index)] [(-q |\r\n```\nFish completion is not working\nFish completion does not seem to work:\r\n\r\n```\r\n$ python my_app.py -sc install=fish | source\r\n$ python my_app.py <TAB> string split: Unknown option \u201c-n\u201d\r\n- (line 2):                        \r\nstring split -n ' ' $COMP_LINE\r\n^                          \r\nin command substitution             \r\n        called on line 0 of file -\r\n                                \r\nin function \u201chydra_fish_completion\u201d\r\n        called on standard input\r\n                      \r\nin command substitution\r\n        called on standard input\r\n                                                                     \r\n\r\n       stringstring - manipulate strings\r\n        -                          \r\n\r\n   Synopsis                        \r\n       string escape [(-n | --no-quoted)] [--style=xxx] [STRING...]\r\n       string join [(-q | --quiet)] SEP [STRING...]\r\n       string length [(-q | --quiet)] [STRING...]\r\n       string lower [(-q | --quiet)] [STRING...]\r\n       string match [(-a | --all)] [((-e | --entire)] [(-i | --ignore-case)] [(-r | --regex)]\r\n                    [(-n | --index)] [(-q |\r\n```\n", "before_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport logging\nimport os\nimport sys\nfrom typing import List, Optional, Tuple\n\nfrom hydra.plugins.completion_plugin import CompletionPlugin\n\nlog = logging.getLogger(__name__)\n\n\nclass FishCompletion(CompletionPlugin):\n    def install(self) -> None:\n        script = \"\"\"function hydra_fish_completion\n    # Hydra will access COMP_LINE to generate completion candidates\n    set -lx COMP_LINE (commandline -cp)\n\n    # Find out how to call the underlying script\n    set -l parts (string split -n ' ' $COMP_LINE)\n    if test \"$parts[1]\" = \"python\" -o \"$parts[1]\" = \"python3\"\n        set cmd \"$parts[1] $parts[2]\"\n        if not grep -q \"@hydra.main\" $parts[2]\n            return\n        end\n    else\n        set cmd \"$parts[1]\"\n    end\n\n    # Generate candidates\n    eval \"$cmd -sc query=fish\"\nend\n        \"\"\"\n        output = self._get_exec()\n        reg_cmd = []\n        for name, cond in output:\n            reg_cmd.append(\n                f\"complete -c {name} {cond}-x -a '(hydra_fish_completion)'\\n\"\n            )\n        print(script)\n        print(\"\".join(reg_cmd))\n\n    def uninstall(self) -> None:\n        name = self._get_uninstall_exec()\n        print(f\"complete -e -c {name}\")\n        print(\"function hydra_fish_completion\\nend\")\n\n    @staticmethod\n    def provides() -> str:\n        return \"fish\"\n\n    def query(self, config_name: Optional[str]) -> None:\n        line = os.environ[\"COMP_LINE\"]\n        line = self.strip_python_or_app_name(line)\n        print(\"\\n\".join(self._query(config_name=config_name, line=line)))\n\n    @staticmethod\n    def help(command: str) -> str:\n        assert command in [\"install\", \"uninstall\"]\n        return f\"{{}} -sc {command}=fish | source\"\n\n    @staticmethod\n    def _get_exec() -> List[Tuple[str, str]]:\n        # Running as an installed app (setuptools entry point)\n        output = []\n        # User scenario 1: python script.py\n        name = os.path.basename(sys.executable)\n        cond = f\"-n '__fish_seen_subcommand_from {sys.argv[0]}' \"\n        output.append((name, cond))\n\n        # User scenario 2: ./script.py or src/script.py or script.py\n        name = os.path.basename(sys.argv[0])\n        cond = \"\"\n        output.append((name, cond))\n\n        return output\n\n    @staticmethod\n    def _get_uninstall_exec() -> str:\n        name = os.path.basename(sys.argv[0])\n\n        return name\n", "path": "hydra/_internal/core_plugins/fish_completion.py"}]}