Skip to content

Commit c7d1c10

Browse files
committed
Use - instead of _ for all user options
* To be consistent with the MRI option style.
1 parent 6e82acc commit c7d1c10

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

spec/truffle/launcher_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,15 @@ def should_print_full_java_command(options, env: {})
210210
end
211211

212212
it 'parses ,' do
213-
out = ruby_exe("puts $LOAD_PATH", options: "--load_paths=a,b")
213+
out = ruby_exe("puts $LOAD_PATH", options: "--load-paths=a,b")
214214
$?.success?.should == true
215215
out.lines[0].should == "#{Dir.pwd}/a\n"
216216
out.lines[1].should == "#{Dir.pwd}/b\n"
217217
end
218218

219219
it 'parses , respecting escaping' do
220220
# \\\\ translates to one \
221-
out = ruby_exe("puts $LOAD_PATH", options: "--load_paths=a\\\\,b,,\\\\c")
221+
out = ruby_exe("puts $LOAD_PATH", options: "--load-paths=a\\\\,b,,\\\\c")
222222
$?.success?.should == true
223223
out.lines[0].should == "#{Dir.pwd}/a,b\n"
224224
out.lines[1].should == "#{Dir.pwd}\n"
@@ -254,7 +254,7 @@ def should_print_full_java_command(options, env: {})
254254
$?.success?.should == true
255255
out.should =~ /language options/i
256256
out.should include("Ruby:")
257-
out.should include("--ruby.load_paths=")
257+
out.should include("--ruby.load-paths=")
258258
end
259259

260260
guard -> { TruffleRuby.sulong? } do

spec/truffle/options/parsing_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
end
3636

3737
it "arrays of strings" do
38-
ruby_exe("p Truffle::Boot.get_option('load_paths')", options: "--load_paths=ruby_spec_test_value").should == "[\"ruby_spec_test_value\"]\n"
39-
ruby_exe("p Truffle::Boot.get_option('load_paths')", options: "--load_paths=a,b,c").should == "[\"a\", \"b\", \"c\"]\n"
40-
ruby_exe("p Truffle::Boot.get_option('load_paths')", options: "--load_paths=a\\\\,b,c").should == "[\"a,b\", \"c\"]\n"
38+
ruby_exe("p Truffle::Boot.get_option('load-paths')", options: "--load-paths=ruby_spec_test_value").should == "[\"ruby_spec_test_value\"]\n"
39+
ruby_exe("p Truffle::Boot.get_option('load-paths')", options: "--load-paths=a,b,c").should == "[\"a\", \"b\", \"c\"]\n"
40+
ruby_exe("p Truffle::Boot.get_option('load-paths')", options: "--load-paths=a\\\\,b,c").should == "[\"a,b\", \"c\"]\n"
4141
end
4242

4343
end

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -291,17 +291,17 @@ public class Options {
291291

292292
public Object fromDescription(OptionDescription<?> description) {
293293
switch (description.getName()) {
294-
case "ruby.load_paths":
294+
case "ruby.load-paths":
295295
return LOAD_PATHS;
296-
case "ruby.required_libraries":
296+
case "ruby.required-libraries":
297297
return REQUIRED_LIBRARIES;
298-
case "ruby.working_directory":
298+
case "ruby.working-directory":
299299
return WORKING_DIRECTORY;
300300
case "ruby.debug":
301301
return DEBUG;
302302
case "ruby.verbose":
303303
return VERBOSITY;
304-
case "ruby.source_encoding":
304+
case "ruby.source-encoding":
305305
return SOURCE_ENCODING;
306306
case "ruby.internal-encoding":
307307
return INTERNAL_ENCODING;

src/main/ruby/post-boot/post-boot.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# GNU Lesser General Public License version 2.1.
1010

1111
Truffle::Boot.delay do
12-
wd = Truffle::Boot.get_option('working_directory')
12+
wd = Truffle::Boot.get_option('working-directory')
1313
Dir.chdir(wd) unless wd.empty?
1414
end
1515

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ public class OptionsCatalog {
2020

2121
public static final StringArrayOptionDescription LOAD_PATHS = new StringArrayOptionDescription(
2222
OptionCategory.USER,
23-
"ruby.load_paths",
23+
"ruby.load-paths",
2424
"Load paths (configured by the -I Ruby option)",
2525
new String[]{"-I"},
2626
new String[]{});
2727
public static final StringArrayOptionDescription REQUIRED_LIBRARIES = new StringArrayOptionDescription(
2828
OptionCategory.USER,
29-
"ruby.required_libraries",
29+
"ruby.required-libraries",
3030
"Required libraries (configured by the -r Ruby option)",
3131
new String[]{"-r"},
3232
new String[]{});
3333
public static final StringOptionDescription WORKING_DIRECTORY = new StringOptionDescription(
3434
OptionCategory.USER,
35-
"ruby.working_directory",
35+
"ruby.working-directory",
3636
"Interpreter will switch to this directory (configured by the -C Ruby option)",
3737
new String[]{"-C"},
3838
"");
@@ -50,7 +50,7 @@ public class OptionsCatalog {
5050
Verbosity.FALSE);
5151
public static final StringOptionDescription SOURCE_ENCODING = new StringOptionDescription(
5252
OptionCategory.USER,
53-
"ruby.source_encoding",
53+
"ruby.source-encoding",
5454
"Source encoding (configured by the -K Ruby option)",
5555
new String[]{"-K"},
5656
"");
@@ -801,17 +801,17 @@ public class OptionsCatalog {
801801

802802
public static OptionDescription<?> fromName(String name) {
803803
switch (name) {
804-
case "ruby.load_paths":
804+
case "ruby.load-paths":
805805
return LOAD_PATHS;
806-
case "ruby.required_libraries":
806+
case "ruby.required-libraries":
807807
return REQUIRED_LIBRARIES;
808-
case "ruby.working_directory":
808+
case "ruby.working-directory":
809809
return WORKING_DIRECTORY;
810810
case "ruby.debug":
811811
return DEBUG;
812812
case "ruby.verbose":
813813
return VERBOSITY;
814-
case "ruby.source_encoding":
814+
case "ruby.source-encoding":
815815
return SOURCE_ENCODING;
816816
case "ruby.internal-encoding":
817817
return INTERNAL_ENCODING;

tool/options.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
USER:
22
# Options corresponding to MRI options, which are also useful outside the TruffleRuby launcher
3-
LOAD_PATHS: [[load_paths, -I], string-array, [], Load paths]
4-
REQUIRED_LIBRARIES: [[required_libraries, -r], string-array, [], Required libraries]
5-
WORKING_DIRECTORY: [[working_directory, -C], string, '', Interpreter will switch to this directory]
3+
LOAD_PATHS: [[load-paths, -I], string-array, [], Load paths]
4+
REQUIRED_LIBRARIES: [[required-libraries, -r], string-array, [], Required libraries]
5+
WORKING_DIRECTORY: [[working-directory, -C], string, '', Interpreter will switch to this directory]
66
DEBUG: [[debug, -d], boolean, false, Debug]
77
VERBOSITY: [[verbose, -v, -w, -W], enum/verbosity, false, Verbosity]
88

9-
SOURCE_ENCODING: [[source_encoding, -K], string, '', Source encoding]
9+
SOURCE_ENCODING: [[source-encoding, -K], string, '', Source encoding]
1010
INTERNAL_ENCODING: [[internal-encoding, -E, -U], string, '', Internal encoding]
1111
EXTERNAL_ENCODING: [[external-encoding, -E], string, '', External encoding]
1212

tool/simplecov_core.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Run with --coverage.global=true if you want coverage of the core library
2-
# $ export TRUFFLERUBYOPT="--coverage.global=true --required_libraries=./tool/simplecov_core.rb"
2+
# $ export TRUFFLERUBYOPT="--coverage.global=true --required-libraries=./tool/simplecov_core.rb"
33
# Then run a hello world, specs, etc
44

55
at_exit do

0 commit comments

Comments
 (0)