Skip to content

Commit 6e82acc

Browse files
committed
Rename --verbosity option --verbose to match MRI
* Also works for `--verbose` as then it's the same as `--verbose=true`. * No need for special handling in the CommandLineParser anymore.
1 parent fbdff90 commit 6e82acc

File tree

8 files changed

+22
-25
lines changed

8 files changed

+22
-25
lines changed

spec/truffle/launcher_spec.rb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ def should_print_full_java_command(options, env: {})
8989
end
9090

9191
it "takes --option options from TRUFFLERUBYOPT" do
92-
out = ruby_exe("puts $VERBOSE", env: { "TRUFFLERUBYOPT" => "--verbosity=true" })
92+
out = ruby_exe("puts $VERBOSE", env: { "TRUFFLERUBYOPT" => "--verbose=true" })
9393
$?.success?.should == true
9494
out.should == "true\n"
9595
end
9696

9797
it "takes --ruby.option options from TRUFFLERUBYOPT" do
98-
out = ruby_exe("puts $VERBOSE", env: { "TRUFFLERUBYOPT" => "--ruby.verbosity=true" })
98+
out = ruby_exe("puts $VERBOSE", env: { "TRUFFLERUBYOPT" => "--ruby.verbose=true" })
9999
$?.success?.should == true
100100
out.should == "true\n"
101101
end
@@ -107,36 +107,36 @@ def should_print_full_java_command(options, env: {})
107107
end
108108

109109
it "takes --option options from RUBYOPT" do
110-
out = ruby_exe("puts $VERBOSE", env: { "RUBYOPT" => "--verbosity=true" })
110+
out = ruby_exe("puts $VERBOSE", env: { "RUBYOPT" => "--verbose=true" })
111111
$?.success?.should == true
112112
out.should == "true\n"
113113
end
114114

115115
it "takes --ruby.option options from RUBYOPT" do
116-
out = ruby_exe("puts $VERBOSE", env: { "RUBYOPT" => "--ruby.verbosity=true" })
116+
out = ruby_exe("puts $VERBOSE", env: { "RUBYOPT" => "--ruby.verbose=true" })
117117
$?.success?.should == true
118118
out.should == "true\n"
119119
end
120120

121121
guard -> { !TruffleRuby.native? } do
122122
it "takes options from system properties set on the command line using --jvm" do
123-
out = ruby_exe("puts $VERBOSE", options: "--jvm.Dpolyglot.ruby.verbosity=true")
123+
out = ruby_exe("puts $VERBOSE", options: "--jvm.Dpolyglot.ruby.verbose=true")
124124
$?.success?.should == true
125125
out.should == "true\n"
126126
end
127127
end
128128

129129
guard -> { TruffleRuby.native? } do
130130
it "takes options from system properties set on the command line using --native" do
131-
out = ruby_exe("puts $VERBOSE", options: "--native.Dpolyglot.ruby.verbosity=true")
131+
out = ruby_exe("puts $VERBOSE", options: "--native.Dpolyglot.ruby.verbose=true")
132132
$?.success?.should == true
133133
out.should == "true\n"
134134
end
135135
end
136136

137137
it "prioritises options on the command line over system properties" do
138138
prefix = TruffleRuby.native? ? 'native' : 'jvm'
139-
out = ruby_exe("puts $VERBOSE", options: "--#{prefix}.Dpolyglot.ruby.verbosity=nil -W2")
139+
out = ruby_exe("puts $VERBOSE", options: "--#{prefix}.Dpolyglot.ruby.verbose=nil -W2")
140140
$?.success?.should == true
141141
out.should == "true\n"
142142
end
@@ -158,7 +158,7 @@ def should_print_full_java_command(options, env: {})
158158
it "prints available user options for --help:languages" do
159159
out = ruby_exe(nil, options: "--help:languages")
160160
$?.success?.should == true
161-
out.should include("--ruby.verbosity")
161+
out.should include("--ruby.verbose")
162162
end
163163

164164
it "prints available expert options for --help:languages --help:expert" do
@@ -188,7 +188,7 @@ def should_print_full_java_command(options, env: {})
188188
$?.success?.should == false
189189
out.should include("invalid option --ruby.unknown=value")
190190
end
191-
191+
192192
it "sets the log level using --log.level=" do
193193
out = ruby_exe("14", options: "--options.log --log.level=CONFIG", args: "2>&1")
194194
$?.success?.should == true
@@ -318,7 +318,7 @@ def should_print_full_java_command(options, env: {})
318318
out.should include("14")
319319
end
320320
end
321-
321+
322322
it "warns on ignored options" do
323323
[
324324
"-y",

spec/truffle/options/parsing_spec.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@
2424
end
2525

2626
it "enum values" do
27-
ruby_exe("p Truffle::Boot.get_option('verbosity')").should_not == ":NIL\n"
28-
ruby_exe("p Truffle::Boot.get_option('verbosity')", options: "--verbosity=NIL").should == ":NIL\n"
27+
ruby_exe("p Truffle::Boot.get_option('verbose')").should_not == ":NIL\n"
28+
ruby_exe("p Truffle::Boot.get_option('verbose')", options: "--verbose=NIL").should == ":NIL\n"
29+
ruby_exe("p Truffle::Boot.get_option('verbose')", options: "--verbose").should == ":TRUE\n"
2930
end
3031

3132
it "strings" do
@@ -52,7 +53,7 @@
5253
end
5354

5455
it "enum values" do
55-
ruby_exe("14", options: "--verbosity=foo", args: "2>&1").should include("Invalid argument --verbosity=foo specified. No enum constant org.truffleruby.shared.options.Verbosity.FOO'")
56+
ruby_exe("14", options: "--verbose=foo", args: "2>&1").should include("Invalid argument --verbose=foo specified. No enum constant org.truffleruby.shared.options.Verbosity.FOO'")
5657
end
5758

5859
end

src/launcher/java/org/truffleruby/launcher/CommandLineParser.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,6 @@ private void processArgument() throws CommandLineException {
442442
enableDisableFeature(enable, true);
443443
}
444444
break FOR;
445-
} else if (argument.equals("--verbose")) {
446-
config.setOption(OptionsCatalog.VERBOSITY, Verbosity.TRUE);
447-
break FOR;
448445
} else if (argument.startsWith("--dump=")) {
449446
warnInternalDebugTool(argument);
450447
break FOR;

src/main/java/org/truffleruby/options/Options.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ public Object fromDescription(OptionDescription<?> description) {
299299
return WORKING_DIRECTORY;
300300
case "ruby.debug":
301301
return DEBUG;
302-
case "ruby.verbosity":
302+
case "ruby.verbose":
303303
return VERBOSITY;
304304
case "ruby.source_encoding":
305305
return SOURCE_ENCODING;

src/main/ruby/core/truffle/kernel_operations.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def self.define_read_only_global(name, getter)
8282

8383
Truffle::Boot.redo do
8484
$DEBUG = Truffle::Boot.get_option 'debug'
85-
$VERBOSE = case Truffle::Boot.get_option 'verbosity'
85+
$VERBOSE = case Truffle::Boot.get_option 'verbose'
8686
when :TRUE
8787
true
8888
when :FALSE

src/shared/java/org/truffleruby/shared/options/OptionsCatalog.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ public class OptionsCatalog {
4444
false);
4545
public static final VerbosityOptionDescription VERBOSITY = new VerbosityOptionDescription(
4646
OptionCategory.USER,
47-
"ruby.verbosity",
48-
"Verbosity (configured by the -v, -w, -W, --verbose Ruby options)",
49-
new String[]{"-v", "-w", "-W", "--verbose"},
47+
"ruby.verbose",
48+
"Verbosity (configured by the -v, -w, -W Ruby options)",
49+
new String[]{"-v", "-w", "-W"},
5050
Verbosity.FALSE);
5151
public static final StringOptionDescription SOURCE_ENCODING = new StringOptionDescription(
5252
OptionCategory.USER,
@@ -809,7 +809,7 @@ public static OptionDescription<?> fromName(String name) {
809809
return WORKING_DIRECTORY;
810810
case "ruby.debug":
811811
return DEBUG;
812-
case "ruby.verbosity":
812+
case "ruby.verbose":
813813
return VERBOSITY;
814814
case "ruby.source_encoding":
815815
return SOURCE_ENCODING;

tool/generate-options.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ def parse_reference_defaults(default)
4747
boxed_type = 'Integer'
4848
default = default.to_s
4949
when /^enum\/(\w*)/
50-
name = $1
51-
type = camelize name
50+
type = camelize $1
5251
boxed_type = type
5352
default = "#{type}.#{default.to_s.upcase}"
5453
when 'string'

tool/options.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ USER:
44
REQUIRED_LIBRARIES: [[required_libraries, -r], string-array, [], Required libraries]
55
WORKING_DIRECTORY: [[working_directory, -C], string, '', Interpreter will switch to this directory]
66
DEBUG: [[debug, -d], boolean, false, Debug]
7-
VERBOSITY: [[verbosity, -v, -w, -W, --verbose], enum/verbosity, false, Verbosity]
7+
VERBOSITY: [[verbose, -v, -w, -W], enum/verbosity, false, Verbosity]
88

99
SOURCE_ENCODING: [[source_encoding, -K], string, '', Source encoding]
1010
INTERNAL_ENCODING: [[internal-encoding, -E, -U], string, '', Internal encoding]

0 commit comments

Comments
 (0)