Skip to content

Commit 49e9ec9

Browse files
committed
Revert help on unrecognized bare options
1 parent 808b052 commit 49e9ec9

File tree

3 files changed

+6
-59
lines changed

3 files changed

+6
-59
lines changed

railties/CHANGELOG.md

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -16,56 +16,6 @@
1616
1717
*Stan Lo*
1818
19-
* `bin/rails` now prints its help message when given an unrecognized bare
20-
option.
21-
22-
__Before__
23-
24-
```console
25-
$ bin/rails -v
26-
Rails 7.2.0.alpha
27-
28-
$ bin/rails -V
29-
rake, version 13.0.6
30-
31-
$ bin/rails -s
32-
Running 0 tests in a single process (parallelization threshold is 50)
33-
...
34-
35-
$ bin/rails -S
36-
invalid option: -S
37-
```
38-
39-
__After__
40-
41-
```console
42-
$ bin/rails -v
43-
Rails 7.2.0.alpha
44-
45-
$ bin/rails -V
46-
Usage:
47-
bin/rails COMMAND [options]
48-
49-
You must specify a command. The most common commands are:
50-
...
51-
52-
$ bin/rails -s
53-
Usage:
54-
bin/rails COMMAND [options]
55-
56-
You must specify a command. The most common commands are:
57-
...
58-
59-
$ bin/rails -S
60-
Usage:
61-
bin/rails COMMAND [options]
62-
63-
You must specify a command. The most common commands are:
64-
...
65-
```
66-
67-
*Jonathan Hefner*
68-
6919
* Ensure `autoload_paths`, `autoload_once_paths`, `eager_load_paths`, and
7020
`load_paths` only have directories when initialized from engine defaults.
7121
Previously, files under the `app` directory could end up there too.

railties/lib/rails/command.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,14 @@ def rails_new_with_no_path?(args)
130130

131131
def split_namespace(namespace)
132132
case namespace
133+
when /^(.+):(\w+)$/
134+
[$1, $2]
135+
when ""
136+
["help", "help"]
133137
when HELP_MAPPINGS, "help"
134138
["help", "help_extended"]
135139
when VERSION_MAPPINGS
136140
["version", "version"]
137-
when "--tasks", "-T"
138-
["", ""]
139-
when /^-/, ""
140-
["help", "help"]
141-
when /^(.+):(\w+)$/
142-
[$1, $2]
143141
else
144142
[namespace, namespace]
145143
end

railties/test/command/help_integration_test.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,8 @@ class Rails::Command::HelpIntegrationTest < ActiveSupport::TestCase
77
setup :build_app
88
teardown :teardown_app
99

10-
test "prints help on unrecognized bare option" do
11-
assert_match "You must specify a command.", rails("--zzz")
12-
assert_match "You must specify a command.", rails("-z")
10+
test "when passing --trace it invokes default" do
11+
assert_match "Invoke default", rails("--trace")
1312
end
1413

1514
test "prints helpful error on unrecognized command" do

0 commit comments

Comments
 (0)