Repository: scrapy/scrapy

Issue:
scrapy parse -h throws error
### Description
running `scrapy parse -h` from inside of a project throws an error.

### Steps to Reproduce
1.  `scrapy startproject example`
2.  `cd example`
3.  `scrapy parse -h`

**Expected behavior:**  It should show the help message output for the `parse` command
**Actual behavior:**  Throws error and displays traceback information
**Reproduces how often:**  Every time I tried it.

### Versions
v2.6.1

### Additional context

I identified the issue and will submit a PR shortly. 

Discussion:
codecov[bot]: # [Codecov](https://codecov.io/gh/scrapy/scrapy/pull/5482?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy) Report
> Merging [#5482](https://codecov.io/gh/scrapy/scrapy/pull/5482?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy) (3cf1166) into [master](https://codecov.io/gh/scrapy/scrapy/commit/ded28f7bb908090952c066a782c8518efaf2dd79?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy) (ded28f7) will **decrease** coverage by `5.56%`.
> The diff coverage is `n/a`.


```diff
@@            Coverage Diff             @@
##           master    #5482      +/-   ##
==========================================
- Coverage   88.58%   83.02%   -5.57%     
==========================================
  Files         163      163              
  Lines       10666    10659       -7     
  Branches     1818     1788      -30     
==========================================
- Hits         9449     8850     -599     
- Misses        941     1546     +605     
+ Partials      276      263      -13     
```

| [Impacted Files](https://codecov.io/gh/scrapy/scrapy/pull/5482?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy) | Coverage Δ | |
|---|---|---|
| [scrapy/commands/parse.py](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy#diff-c2NyYXB5L2NvbW1hbmRzL3BhcnNlLnB5) | `28.08% <ø> (+1.12%)` | :arrow_up: |
| [scrapy/core/http2/stream.py](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy#diff-c2NyYXB5L2NvcmUvaHR0cDIvc3RyZWFtLnB5) | `0.00% <0.00%> (-91.38%)` | :arrow_down: |
| [scrapy/core/downloader/handlers/http2.py](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy#diff-c2NyYXB5L2NvcmUvZG93bmxvYWRlci9oYW5kbGVycy9odHRwMi5weQ==) | `14.47% <0.00%> (-85.53%)` | :arrow_down: |
| [scrapy/core/http2/agent.py](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy#diff-c2NyYXB5L2NvcmUvaHR0cDIvYWdlbnQucHk=) | `13.25% <0.00%> (-83.14%)` | :arrow_down: |
| [scrapy/core/http2/protocol.py](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy#diff-c2NyYXB5L2NvcmUvaHR0cDIvcHJvdG9jb2wucHk=) | `3.51% <0.00%> (-79.90%)` | :arrow_down: |
| [scrapy/utils/asyncgen.py](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy#diff-c2NyYXB5L3V0aWxzL2FzeW5jZ2VuLnB5) | `33.33% <0.00%> (-66.67%)` | :arrow_down: |
| [scrapy/pipelines/images.py](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy#diff-c2NyYXB5L3BpcGVsaW5lcy9pbWFnZXMucHk=) | `27.82% <0.00%> (-62.61%)` | :arrow_down: |
| [scrapy/utils/test.py](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy#diff-c2NyYXB5L3V0aWxzL3Rlc3QucHk=) | `43.75% <0.00%> (-17.19%)` | :arrow_down: |
| [scrapy/utils/ssl.py](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy#diff-c2NyYXB5L3V0aWxzL3NzbC5weQ==) | `53.65% <0.00%> (-17.08%)` | :arrow_down: |
| [scrapy/utils/spider.py](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy#diff-c2NyYXB5L3V0aWxzL3NwaWRlci5weQ==) | `69.69% <0.00%> (-12.13%)` | :arrow_down: |
| ... and [17 more](https://codecov.io/gh/scrapy/scrapy/pull/5482/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scrapy) | |

alexpdev: > Looks good, thank you. Two suggestions for the future:
> 
> * There's no need to open an issue if you already have a patch in mind, you can submit a PR directly
> * Use a descriptive name in the PR. This will (probably) be the message we end up using when merging, and "fixes issue #N" is not good for the history

Thanks for the advice.
Gallaecio: @Laerte Could you rebase this change into the 2.6 branch instead of `master`?
Laerte: @Gallaecio You want me to cherry-pick the changes from his branch and apply above `2.6` branch? In this case we will need open another PR? (I don't have write access to his branch that's why i thinked on this approach.
alexpdev: How do i grant write access?
Laerte: @alexpdev You can follow these steps: https://github.com/scrapy/scrapy/pull/5445#issuecomment-1062664683

(Change the commit id of course)
alexpdev: > @alexpdev You can follow these steps: [#5445 (comment)](https://github.com/scrapy/scrapy/pull/5445#issuecomment-1062664683)
> 
> (Change the commit id of course)

on the line that starts with `git checkout` I'm getting `fatal 'upstream/2.6' is not a commit and a branch 'master' cannot be created from it`

Patch:
diff --git a/scrapy/commands/parse.py b/scrapy/commands/parse.py
index a3f6b96f4..8e52d0d76 100644
--- a/scrapy/commands/parse.py
+++ b/scrapy/commands/parse.py
@@ -51,7 +51,7 @@ class Command(BaseRunSpiderCommand):
         parser.add_argument("--cbkwargs", dest="cbkwargs",
                             help="inject extra callback kwargs into the Request, it must be a valid raw json string")
         parser.add_argument("-d", "--depth", dest="depth", type=int, default=1,
-                            help="maximum depth for parsing requests [default: %default]")
+                            help="maximum depth for parsing requests [default: %(default)s]")
         parser.add_argument("-v", "--verbose", dest="verbose", action="store_true",
                             help="print each depth level one by one")
 


Test patch:
diff --git a/tests/test_commands.py b/tests/test_commands.py
index b5e6c2b8b..76d5f3935 100644
--- a/tests/test_commands.py
+++ b/tests/test_commands.py
@@ -930,3 +930,17 @@ class MySpider(scrapy.Spider):
         args = ['-o', 'example1.json', '-O', 'example2.json']
         log = self.get_log(spider_code, args=args)
         self.assertIn("error: Please use only one of -o/--output and -O/--overwrite-output", log)
+
+
+class HelpMessageTest(CommandTest):
+
+    def setUp(self):
+        super().setUp()
+        self.commands = ["parse", "startproject", "view", "crawl", "edit",
+                         "list", "fetch", "settings", "shell", "runspider",
+                         "version", "genspider", "check", "bench"]
+
+    def test_help_messages(self):
+        for command in self.commands:
+            _, out, _ = self.proc(command, "-h")
+            self.assertIn("Usage", out)