prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Clean up --cfg
  It will be cleaner for --cfg to always take one of job|hydra|all, and not have it default to job.
  this will eliminate the problem that occures when --cfg is not the last flag in the command line and some override is associated with --cfg.
  
  </issue>
  <code>
  [start of hydra/_internal/utils.py]
  1 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
  2 import inspect
  3 import os
  4 import sys
  5 from .hydra import Hydra
  6 import argparse
  7 
  8 
  9 def run_hydra(args_parser, task_function, config_path, strict):
  10     stack = inspect.stack()
  11     frame = stack[2]
  12 
  13     calling_file = None
  14     calling__module = None
  15     try:
  16         calling_file = frame[0].f_locals["__file__"]
  17     except KeyError:
  18         pass
  19     try:
  20         module_envs = ["HYDRA_MAIN_MODULE", "FB_PAR_MAIN_MODULE", "FB_XAR_MAIN_MODULE"]
  21         for module_env in module_envs:
  22             if module_env in os.environ:
  23                 calling__module = os.environ[module_env]
  24                 break
  25 
  26         if calling__module is None:
  27             calling__module = frame[0].f_globals[frame[3]].__module__
  28     except KeyError:
  29         pass
  30 
  31     hydra = Hydra(
  32         calling_file=calling_file,
  33         calling_module=calling__module,
  34         config_path=config_path,
  35         task_function=task_function,
  36         strict=strict,
  37     )
  38 
  39     args = args_parser.parse_args()
  40     if args.help:
  41         hydra.app_help(args_parser=args_parser, args=args)
  42         sys.exit(0)
  43     if args.hydra_help:
  44         hydra.hydra_help(args_parser=args_parser, args=args)
  45         sys.exit(0)
  46 
  47     has_show_cfg = args.cfg is not None
  48     num_commands = args.run + has_show_cfg + args.multirun + args.shell_completion
  49     if num_commands > 1:
  50         raise ValueError(
  51             "Only one of --run, --multirun,  -cfg and --shell_completion can be specified"
  52         )
  53     if num_commands == 0:
  54         args.run = True
  55     if args.run:
  56         hydra.run(overrides=args.overrides)
  57     elif args.multirun:
  58         hydra.multirun(overrides=args.overrides)
  59     elif args.cfg:
  60         hydra.show_cfg(overrides=args.overrides, cfg_type=args.cfg)
  61     elif args.shell_completion:
  62         hydra.shell_completion(overrides=args.overrides)
  63     else:
  64         print("Command not specified")
  65         sys.exit(1)
  66 
  67 
  68 def _get_exec_command():
  69     if sys.argv[0].endswith(".py"):
  70         return "python {}".format(sys.argv[0])
  71     else:
  72         # Running as an installed app (setuptools entry point)
  73         executable = os.path.basename(sys.argv[0])
  74         return executable
  75 
  76 
  77 def get_args_parser():
  78     from .. import __version__
  79 
  80     parser = argparse.ArgumentParser(add_help=False, description="Hydra")
  81     parser.add_argument("--help", "-h", action="store_true", help="Application's help")
  82     parser.add_argument("--hydra-help", action="store_true", help="Hydra's help")
  83     parser.add_argument(
  84         "--version", action="version", version="Hydra {}".format(__version__)
  85     )
  86     parser.add_argument(
  87         "overrides",
  88         nargs="*",
  89         help="Any key=value arguments to override config values (use dots for.nested=overrides)",
  90     )
  91 
  92     parser.add_argument(
  93         "--cfg",
  94         "-c",
  95         const="job",
  96         nargs="?",
  97         choices=["job", "hydra", "all"],
  98         help="Show config instead of running, optional value indicates which config to show (defaults to job)",
  99     )
  100 
  101     parser.add_argument("--run", "-r", action="store_true", help="Run a job")
  102 
  103     parser.add_argument(
  104         "--multirun",
  105         "-m",
  106         action="store_true",
  107         help="Run multiple jobs with the configured launcher",
  108     )
  109 
  110     shell = "SHELL_NAME"
  111     install_cmd = 'eval "$({} -sc install={})"'.format(_get_exec_command(), shell)
  112     uninstall_cmd = 'eval "$({} -sc uninstall={})"'.format(_get_exec_command(), shell)
  113     parser.add_argument(
  114         "--shell_completion",
  115         "-sc",
  116         action="store_true",
  117         help="""Install or Uninstall shell completion:
  118     Install:
  119     {}
  120 
  121     Uninstall:
  122     {}
  123 """.format(
  124             install_cmd, uninstall_cmd
  125         ),
  126     )
  127     return parser
  128 
  129 
  130 def get_args(args=None):
  131     return get_args_parser().parse_args(args=args)
  132
  [end of hydra/_internal/utils.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/utils.py b/hydra/_internal/utils.py
  --- a/hydra/_internal/utils.py
  +++ b/hydra/_internal/utils.py
  @@ -92,10 +92,8 @@
       parser.add_argument(
           "--cfg",
           "-c",
  -        const="job",
  -        nargs="?",
           choices=["job", "hydra", "all"],
  -        help="Show config instead of running, optional value indicates which config to show (defaults to job)",
  +        help="Show config instead of running [job|hydra|all]",
       )
   
       parser.add_argument("--run", "-r", action="store_true", help="Run a job")
  
verification_info: {"golden_diff": "diff --git a/hydra/_internal/utils.py b/hydra/_internal/utils.py\n--- a/hydra/_internal/utils.py\n+++ b/hydra/_internal/utils.py\n@@ -92,10 +92,8 @@\n     parser.add_argument(\n         \"--cfg\",\n         \"-c\",\n-        const=\"job\",\n-        nargs=\"?\",\n         choices=[\"job\", \"hydra\", \"all\"],\n-        help=\"Show config instead of running, optional value indicates which config to show (defaults to job)\",\n+        help=\"Show config instead of running [job|hydra|all]\",\n     )\n \n     parser.add_argument(\"--run\", \"-r\", action=\"store_true\", help=\"Run a job\")\n", "issue": "Clean up --cfg\nIt will be cleaner for --cfg to always take one of job|hydra|all, and not have it default to job.\r\nthis will eliminate the problem that occures when --cfg is not the last flag in the command line and some override is associated with --cfg.\n", "before_files": [{"content": "# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved\nimport inspect\nimport os\nimport sys\nfrom .hydra import Hydra\nimport argparse\n\n\ndef run_hydra(args_parser, task_function, config_path, strict):\n    stack = inspect.stack()\n    frame = stack[2]\n\n    calling_file = None\n    calling__module = None\n    try:\n        calling_file = frame[0].f_locals[\"__file__\"]\n    except KeyError:\n        pass\n    try:\n        module_envs = [\"HYDRA_MAIN_MODULE\", \"FB_PAR_MAIN_MODULE\", \"FB_XAR_MAIN_MODULE\"]\n        for module_env in module_envs:\n            if module_env in os.environ:\n                calling__module = os.environ[module_env]\n                break\n\n        if calling__module is None:\n            calling__module = frame[0].f_globals[frame[3]].__module__\n    except KeyError:\n        pass\n\n    hydra = Hydra(\n        calling_file=calling_file,\n        calling_module=calling__module,\n        config_path=config_path,\n        task_function=task_function,\n        strict=strict,\n    )\n\n    args = args_parser.parse_args()\n    if args.help:\n        hydra.app_help(args_parser=args_parser, args=args)\n        sys.exit(0)\n    if args.hydra_help:\n        hydra.hydra_help(args_parser=args_parser, args=args)\n        sys.exit(0)\n\n    has_show_cfg = args.cfg is not None\n    num_commands = args.run + has_show_cfg + args.multirun + args.shell_completion\n    if num_commands > 1:\n        raise ValueError(\n            \"Only one of --run, --multirun,  -cfg and --shell_completion can be specified\"\n        )\n    if num_commands == 0:\n        args.run = True\n    if args.run:\n        hydra.run(overrides=args.overrides)\n    elif args.multirun:\n        hydra.multirun(overrides=args.overrides)\n    elif args.cfg:\n        hydra.show_cfg(overrides=args.overrides, cfg_type=args.cfg)\n    elif args.shell_completion:\n        hydra.shell_completion(overrides=args.overrides)\n    else:\n        print(\"Command not specified\")\n        sys.exit(1)\n\n\ndef _get_exec_command():\n    if sys.argv[0].endswith(\".py\"):\n        return \"python {}\".format(sys.argv[0])\n    else:\n        # Running as an installed app (setuptools entry point)\n        executable = os.path.basename(sys.argv[0])\n        return executable\n\n\ndef get_args_parser():\n    from .. import __version__\n\n    parser = argparse.ArgumentParser(add_help=False, description=\"Hydra\")\n    parser.add_argument(\"--help\", \"-h\", action=\"store_true\", help=\"Application's help\")\n    parser.add_argument(\"--hydra-help\", action=\"store_true\", help=\"Hydra's help\")\n    parser.add_argument(\n        \"--version\", action=\"version\", version=\"Hydra {}\".format(__version__)\n    )\n    parser.add_argument(\n        \"overrides\",\n        nargs=\"*\",\n        help=\"Any key=value arguments to override config values (use dots for.nested=overrides)\",\n    )\n\n    parser.add_argument(\n        \"--cfg\",\n        \"-c\",\n        const=\"job\",\n        nargs=\"?\",\n        choices=[\"job\", \"hydra\", \"all\"],\n        help=\"Show config instead of running, optional value indicates which config to show (defaults to job)\",\n    )\n\n    parser.add_argument(\"--run\", \"-r\", action=\"store_true\", help=\"Run a job\")\n\n    parser.add_argument(\n        \"--multirun\",\n        \"-m\",\n        action=\"store_true\",\n        help=\"Run multiple jobs with the configured launcher\",\n    )\n\n    shell = \"SHELL_NAME\"\n    install_cmd = 'eval \"$({} -sc install={})\"'.format(_get_exec_command(), shell)\n    uninstall_cmd = 'eval \"$({} -sc uninstall={})\"'.format(_get_exec_command(), shell)\n    parser.add_argument(\n        \"--shell_completion\",\n        \"-sc\",\n        action=\"store_true\",\n        help=\"\"\"Install or Uninstall shell completion:\n    Install:\n    {}\n\n    Uninstall:\n    {}\n\"\"\".format(\n            install_cmd, uninstall_cmd\n        ),\n    )\n    return parser\n\n\ndef get_args(args=None):\n    return get_args_parser().parse_args(args=args)\n", "path": "hydra/_internal/utils.py"}]}