prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Suggestion: pcreate should list the template part of basic usage
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pyramid/scripts/pcreate.py`
  Content:
  ```
  1 # (c) 2005 Ian Bicking and contributors; written for Paste
  2 # (http://pythonpaste.org) Licensed under the MIT license:
  3 # http://www.opensource.org/licenses/mit-license.php
  4 
  5 import optparse
  6 import os
  7 import os.path
  8 import pkg_resources
  9 import re
  10 import sys
  11 
  12 _bad_chars_re = re.compile('[^a-zA-Z0-9_]')
  13 
  14 def main(argv=sys.argv, quiet=False):
  15     command = PCreateCommand(argv, quiet)
  16     return command.run()
  17 
  18 class PCreateCommand(object):
  19     verbosity = 1 # required
  20     description = "Render Pyramid scaffolding to an output directory"
  21     usage = "usage: %prog [options] output_directory"
  22     parser = optparse.OptionParser(usage, description=description)
  23     parser.add_option('-s', '--scaffold',
  24                       dest='scaffold_name',
  25                       action='append',
  26                       help=("Add a scaffold to the create process "
  27                             "(multiple -s args accepted)"))
  28     parser.add_option('-t', '--template',
  29                       dest='scaffold_name',
  30                       action='append',
  31                       help=('A backwards compatibility alias for '
  32                             '-s/--scaffold.  Add a scaffold to the '
  33                             'create process (multiple -t args accepted)'))
  34     parser.add_option('-l', '--list',
  35                       dest='list',
  36                       action='store_true',
  37                       help="List all available scaffold names")
  38     parser.add_option('--list-templates',
  39                       dest='list',
  40                       action='store_true',
  41                       help=("A backwards compatibility alias for -l/--list.  "
  42                             "List all available scaffold names."))
  43     parser.add_option('--simulate',
  44                       dest='simulate',
  45                       action='store_true',
  46                       help='Simulate but do no work')
  47     parser.add_option('--overwrite',
  48                       dest='overwrite',
  49                       action='store_true',
  50                       help='Always overwrite')
  51     parser.add_option('--interactive',
  52                       dest='interactive',
  53                       action='store_true',
  54                       help='When a file would be overwritten, interrogate')
  55 
  56     pyramid_dist = pkg_resources.get_distribution("pyramid")
  57 
  58     def __init__(self, argv, quiet=False):
  59         self.quiet = quiet
  60         self.options, self.args = self.parser.parse_args(argv[1:])
  61         self.scaffolds = self.all_scaffolds()
  62 
  63     def run(self):
  64         if self.options.list:
  65             return self.show_scaffolds()
  66         if not self.options.scaffold_name:
  67             self.out('You must provide at least one scaffold name')
  68             return 2
  69         if not self.args:
  70             self.out('You must provide a project name')
  71             return 2
  72         available = [x.name for x in self.scaffolds]
  73         diff = set(self.options.scaffold_name).difference(available)
  74         if diff:
  75             self.out('Unavailable scaffolds: %s' % list(diff))
  76             return 2
  77         return self.render_scaffolds()
  78 
  79     def render_scaffolds(self):
  80         options = self.options
  81         args = self.args
  82         output_dir = os.path.abspath(os.path.normpath(args[0]))
  83         project_name = os.path.basename(os.path.split(output_dir)[1])
  84         pkg_name = _bad_chars_re.sub(
  85             '', project_name.lower().replace('-', '_'))
  86         safe_name = pkg_resources.safe_name(project_name)
  87         egg_name = pkg_resources.to_filename(safe_name)
  88 
  89         # get pyramid package version
  90         pyramid_version = self.pyramid_dist.version
  91 
  92         ## map pyramid package version of the documentation branch ##
  93         # if version ends with 'dev' then docs version is 'master'
  94         if self.pyramid_dist.version[-3:] == 'dev':
  95             pyramid_docs_branch = 'master'
  96         else:
  97             # if not version is not 'dev' find the version.major_version string
  98             # and combine it with '-branch'
  99             version_match = re.match(r'(\d+\.\d+)', self.pyramid_dist.version)
  100             if version_match is not None:
  101                 pyramid_docs_branch = "%s-branch" % version_match.group()
  102             # if can not parse the version then default to 'latest'
  103             else:
  104                 pyramid_docs_branch = 'latest'
  105 
  106         vars = {
  107             'project': project_name,
  108             'package': pkg_name,
  109             'egg': egg_name,
  110             'pyramid_version': pyramid_version,
  111             'pyramid_docs_branch': pyramid_docs_branch,
  112             }
  113         for scaffold_name in options.scaffold_name:
  114             for scaffold in self.scaffolds:
  115                 if scaffold.name == scaffold_name:
  116                     scaffold.run(self, output_dir, vars)
  117         return 0
  118 
  119     def show_scaffolds(self):
  120         scaffolds = sorted(self.scaffolds, key=lambda x: x.name)
  121         if scaffolds:
  122             max_name = max([len(t.name) for t in scaffolds])
  123             self.out('Available scaffolds:')
  124             for scaffold in scaffolds:
  125                 self.out('  %s:%s  %s' % (
  126                     scaffold.name,
  127                     ' '*(max_name-len(scaffold.name)), scaffold.summary))
  128         else:
  129             self.out('No scaffolds available')
  130         return 0
  131 
  132     def all_scaffolds(self):
  133         scaffolds = []
  134         eps = list(pkg_resources.iter_entry_points('pyramid.scaffold'))
  135         for entry in eps:
  136             try:
  137                 scaffold_class = entry.load()
  138                 scaffold = scaffold_class(entry.name)
  139                 scaffolds.append(scaffold)
  140             except Exception as e: # pragma: no cover
  141                 self.out('Warning: could not load entry point %s (%s: %s)' % (
  142                     entry.name, e.__class__.__name__, e))
  143         return scaffolds
  144 
  145     def out(self, msg): # pragma: no cover
  146         if not self.quiet:
  147             print(msg)
  148 
  149 if __name__ == '__main__': # pragma: no cover
  150     sys.exit(main() or 0)
  151
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py
  --- a/pyramid/scripts/pcreate.py
  +++ b/pyramid/scripts/pcreate.py
  @@ -18,7 +18,7 @@
   class PCreateCommand(object):
       verbosity = 1 # required
       description = "Render Pyramid scaffolding to an output directory"
  -    usage = "usage: %prog [options] output_directory"
  +    usage = "usage: %prog [options] -s <scaffold> output_directory"
       parser = optparse.OptionParser(usage, description=description)
       parser.add_option('-s', '--scaffold',
                         dest='scaffold_name',
  @@ -63,8 +63,16 @@
       def run(self):
           if self.options.list:
               return self.show_scaffolds()
  +        if not self.options.scaffold_name and not self.args:
  +            if not self.quiet: # pragma: no cover
  +                self.parser.print_help()
  +                self.out('')
  +                self.show_scaffolds()
  +            return 2
           if not self.options.scaffold_name:
  -            self.out('You must provide at least one scaffold name')
  +            self.out('You must provide at least one scaffold name: -s <scaffold name>')
  +            self.out('')
  +            self.show_scaffolds()
               return 2
           if not self.args:
               self.out('You must provide a project name')
  
verification_info: {"golden_diff": "diff --git a/pyramid/scripts/pcreate.py b/pyramid/scripts/pcreate.py\n--- a/pyramid/scripts/pcreate.py\n+++ b/pyramid/scripts/pcreate.py\n@@ -18,7 +18,7 @@\n class PCreateCommand(object):\n     verbosity = 1 # required\n     description = \"Render Pyramid scaffolding to an output directory\"\n-    usage = \"usage: %prog [options] output_directory\"\n+    usage = \"usage: %prog [options] -s <scaffold> output_directory\"\n     parser = optparse.OptionParser(usage, description=description)\n     parser.add_option('-s', '--scaffold',\n                       dest='scaffold_name',\n@@ -63,8 +63,16 @@\n     def run(self):\n         if self.options.list:\n             return self.show_scaffolds()\n+        if not self.options.scaffold_name and not self.args:\n+            if not self.quiet: # pragma: no cover\n+                self.parser.print_help()\n+                self.out('')\n+                self.show_scaffolds()\n+            return 2\n         if not self.options.scaffold_name:\n-            self.out('You must provide at least one scaffold name')\n+            self.out('You must provide at least one scaffold name: -s <scaffold name>')\n+            self.out('')\n+            self.show_scaffolds()\n             return 2\n         if not self.args:\n             self.out('You must provide a project name')\n", "issue": "Suggestion: pcreate should list the template part of basic usage\n\n", "before_files": [{"content": "# (c) 2005 Ian Bicking and contributors; written for Paste\n# (http://pythonpaste.org) Licensed under the MIT license:\n# http://www.opensource.org/licenses/mit-license.php\n\nimport optparse\nimport os\nimport os.path\nimport pkg_resources\nimport re\nimport sys\n\n_bad_chars_re = re.compile('[^a-zA-Z0-9_]')\n\ndef main(argv=sys.argv, quiet=False):\n    command = PCreateCommand(argv, quiet)\n    return command.run()\n\nclass PCreateCommand(object):\n    verbosity = 1 # required\n    description = \"Render Pyramid scaffolding to an output directory\"\n    usage = \"usage: %prog [options] output_directory\"\n    parser = optparse.OptionParser(usage, description=description)\n    parser.add_option('-s', '--scaffold',\n                      dest='scaffold_name',\n                      action='append',\n                      help=(\"Add a scaffold to the create process \"\n                            \"(multiple -s args accepted)\"))\n    parser.add_option('-t', '--template',\n                      dest='scaffold_name',\n                      action='append',\n                      help=('A backwards compatibility alias for '\n                            '-s/--scaffold.  Add a scaffold to the '\n                            'create process (multiple -t args accepted)'))\n    parser.add_option('-l', '--list',\n                      dest='list',\n                      action='store_true',\n                      help=\"List all available scaffold names\")\n    parser.add_option('--list-templates',\n                      dest='list',\n                      action='store_true',\n                      help=(\"A backwards compatibility alias for -l/--list.  \"\n                            \"List all available scaffold names.\"))\n    parser.add_option('--simulate',\n                      dest='simulate',\n                      action='store_true',\n                      help='Simulate but do no work')\n    parser.add_option('--overwrite',\n                      dest='overwrite',\n                      action='store_true',\n                      help='Always overwrite')\n    parser.add_option('--interactive',\n                      dest='interactive',\n                      action='store_true',\n                      help='When a file would be overwritten, interrogate')\n\n    pyramid_dist = pkg_resources.get_distribution(\"pyramid\")\n\n    def __init__(self, argv, quiet=False):\n        self.quiet = quiet\n        self.options, self.args = self.parser.parse_args(argv[1:])\n        self.scaffolds = self.all_scaffolds()\n\n    def run(self):\n        if self.options.list:\n            return self.show_scaffolds()\n        if not self.options.scaffold_name:\n            self.out('You must provide at least one scaffold name')\n            return 2\n        if not self.args:\n            self.out('You must provide a project name')\n            return 2\n        available = [x.name for x in self.scaffolds]\n        diff = set(self.options.scaffold_name).difference(available)\n        if diff:\n            self.out('Unavailable scaffolds: %s' % list(diff))\n            return 2\n        return self.render_scaffolds()\n\n    def render_scaffolds(self):\n        options = self.options\n        args = self.args\n        output_dir = os.path.abspath(os.path.normpath(args[0]))\n        project_name = os.path.basename(os.path.split(output_dir)[1])\n        pkg_name = _bad_chars_re.sub(\n            '', project_name.lower().replace('-', '_'))\n        safe_name = pkg_resources.safe_name(project_name)\n        egg_name = pkg_resources.to_filename(safe_name)\n\n        # get pyramid package version\n        pyramid_version = self.pyramid_dist.version\n\n        ## map pyramid package version of the documentation branch ##\n        # if version ends with 'dev' then docs version is 'master'\n        if self.pyramid_dist.version[-3:] == 'dev':\n            pyramid_docs_branch = 'master'\n        else:\n            # if not version is not 'dev' find the version.major_version string\n            # and combine it with '-branch'\n            version_match = re.match(r'(\\d+\\.\\d+)', self.pyramid_dist.version)\n            if version_match is not None:\n                pyramid_docs_branch = \"%s-branch\" % version_match.group()\n            # if can not parse the version then default to 'latest'\n            else:\n                pyramid_docs_branch = 'latest'\n\n        vars = {\n            'project': project_name,\n            'package': pkg_name,\n            'egg': egg_name,\n            'pyramid_version': pyramid_version,\n            'pyramid_docs_branch': pyramid_docs_branch,\n            }\n        for scaffold_name in options.scaffold_name:\n            for scaffold in self.scaffolds:\n                if scaffold.name == scaffold_name:\n                    scaffold.run(self, output_dir, vars)\n        return 0\n\n    def show_scaffolds(self):\n        scaffolds = sorted(self.scaffolds, key=lambda x: x.name)\n        if scaffolds:\n            max_name = max([len(t.name) for t in scaffolds])\n            self.out('Available scaffolds:')\n            for scaffold in scaffolds:\n                self.out('  %s:%s  %s' % (\n                    scaffold.name,\n                    ' '*(max_name-len(scaffold.name)), scaffold.summary))\n        else:\n            self.out('No scaffolds available')\n        return 0\n\n    def all_scaffolds(self):\n        scaffolds = []\n        eps = list(pkg_resources.iter_entry_points('pyramid.scaffold'))\n        for entry in eps:\n            try:\n                scaffold_class = entry.load()\n                scaffold = scaffold_class(entry.name)\n                scaffolds.append(scaffold)\n            except Exception as e: # pragma: no cover\n                self.out('Warning: could not load entry point %s (%s: %s)' % (\n                    entry.name, e.__class__.__name__, e))\n        return scaffolds\n\n    def out(self, msg): # pragma: no cover\n        if not self.quiet:\n            print(msg)\n\nif __name__ == '__main__': # pragma: no cover\n    sys.exit(main() or 0)\n", "path": "pyramid/scripts/pcreate.py"}], "after_files": [{"content": "# (c) 2005 Ian Bicking and contributors; written for Paste\n# (http://pythonpaste.org) Licensed under the MIT license:\n# http://www.opensource.org/licenses/mit-license.php\n\nimport optparse\nimport os\nimport os.path\nimport pkg_resources\nimport re\nimport sys\n\n_bad_chars_re = re.compile('[^a-zA-Z0-9_]')\n\ndef main(argv=sys.argv, quiet=False):\n    command = PCreateCommand(argv, quiet)\n    return command.run()\n\nclass PCreateCommand(object):\n    verbosity = 1 # required\n    description = \"Render Pyramid scaffolding to an output directory\"\n    usage = \"usage: %prog [options] -s <scaffold> output_directory\"\n    parser = optparse.OptionParser(usage, description=description)\n    parser.add_option('-s', '--scaffold',\n                      dest='scaffold_name',\n                      action='append',\n                      help=(\"Add a scaffold to the create process \"\n                            \"(multiple -s args accepted)\"))\n    parser.add_option('-t', '--template',\n                      dest='scaffold_name',\n                      action='append',\n                      help=('A backwards compatibility alias for '\n                            '-s/--scaffold.  Add a scaffold to the '\n                            'create process (multiple -t args accepted)'))\n    parser.add_option('-l', '--list',\n                      dest='list',\n                      action='store_true',\n                      help=\"List all available scaffold names\")\n    parser.add_option('--list-templates',\n                      dest='list',\n                      action='store_true',\n                      help=(\"A backwards compatibility alias for -l/--list.  \"\n                            \"List all available scaffold names.\"))\n    parser.add_option('--simulate',\n                      dest='simulate',\n                      action='store_true',\n                      help='Simulate but do no work')\n    parser.add_option('--overwrite',\n                      dest='overwrite',\n                      action='store_true',\n                      help='Always overwrite')\n    parser.add_option('--interactive',\n                      dest='interactive',\n                      action='store_true',\n                      help='When a file would be overwritten, interrogate')\n\n    pyramid_dist = pkg_resources.get_distribution(\"pyramid\")\n\n    def __init__(self, argv, quiet=False):\n        self.quiet = quiet\n        self.options, self.args = self.parser.parse_args(argv[1:])\n        self.scaffolds = self.all_scaffolds()\n\n    def run(self):\n        if self.options.list:\n            return self.show_scaffolds()\n        if not self.options.scaffold_name and not self.args:\n            if not self.quiet: # pragma: no cover\n                self.parser.print_help()\n                self.out('')\n                self.show_scaffolds()\n            return 2\n        if not self.options.scaffold_name:\n            self.out('You must provide at least one scaffold name: -s <scaffold name>')\n            self.out('')\n            self.show_scaffolds()\n            return 2\n        if not self.args:\n            self.out('You must provide a project name')\n            return 2\n        available = [x.name for x in self.scaffolds]\n        diff = set(self.options.scaffold_name).difference(available)\n        if diff:\n            self.out('Unavailable scaffolds: %s' % list(diff))\n            return 2\n        return self.render_scaffolds()\n\n    def render_scaffolds(self):\n        options = self.options\n        args = self.args\n        output_dir = os.path.abspath(os.path.normpath(args[0]))\n        project_name = os.path.basename(os.path.split(output_dir)[1])\n        pkg_name = _bad_chars_re.sub(\n            '', project_name.lower().replace('-', '_'))\n        safe_name = pkg_resources.safe_name(project_name)\n        egg_name = pkg_resources.to_filename(safe_name)\n\n        # get pyramid package version\n        pyramid_version = self.pyramid_dist.version\n\n        ## map pyramid package version of the documentation branch ##\n        # if version ends with 'dev' then docs version is 'master'\n        if self.pyramid_dist.version[-3:] == 'dev':\n            pyramid_docs_branch = 'master'\n        else:\n            # if not version is not 'dev' find the version.major_version string\n            # and combine it with '-branch'\n            version_match = re.match(r'(\\d+\\.\\d+)', self.pyramid_dist.version)\n            if version_match is not None:\n                pyramid_docs_branch = \"%s-branch\" % version_match.group()\n            # if can not parse the version then default to 'latest'\n            else:\n                pyramid_docs_branch = 'latest'\n\n        vars = {\n            'project': project_name,\n            'package': pkg_name,\n            'egg': egg_name,\n            'pyramid_version': pyramid_version,\n            'pyramid_docs_branch': pyramid_docs_branch,\n            }\n        for scaffold_name in options.scaffold_name:\n            for scaffold in self.scaffolds:\n                if scaffold.name == scaffold_name:\n                    scaffold.run(self, output_dir, vars)\n        return 0\n\n    def show_scaffolds(self):\n        scaffolds = sorted(self.scaffolds, key=lambda x: x.name)\n        if scaffolds:\n            max_name = max([len(t.name) for t in scaffolds])\n            self.out('Available scaffolds:')\n            for scaffold in scaffolds:\n                self.out('  %s:%s  %s' % (\n                    scaffold.name,\n                    ' '*(max_name-len(scaffold.name)), scaffold.summary))\n        else:\n            self.out('No scaffolds available')\n        return 0\n\n    def all_scaffolds(self):\n        scaffolds = []\n        eps = list(pkg_resources.iter_entry_points('pyramid.scaffold'))\n        for entry in eps:\n            try:\n                scaffold_class = entry.load()\n                scaffold = scaffold_class(entry.name)\n                scaffolds.append(scaffold)\n            except Exception as e: # pragma: no cover\n                self.out('Warning: could not load entry point %s (%s: %s)' % (\n                    entry.name, e.__class__.__name__, e))\n        return scaffolds\n\n    def out(self, msg): # pragma: no cover\n        if not self.quiet:\n            print(msg)\n\nif __name__ == '__main__': # pragma: no cover\n    sys.exit(main() or 0)\n", "path": "pyramid/scripts/pcreate.py"}]}