Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d24e126

Browse filesBrowse files
committed
More helpful handling of unrecognized exe/arduino_ci.rb parameters
1 parent 4b1084d commit d24e126
Copy full SHA for d24e126

File tree

2 files changed

+23
-10
lines changed
Filter options

2 files changed

+23
-10
lines changed

‎CHANGELOG.md

Copy file name to clipboardExpand all lines: CHANGELOG.md
+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2020

2121
### Fixed
2222
- Fix phrasing of free-space check
23+
- Handle unrecognized command line errors in a nicer way
2324

2425
### Security
2526

‎exe/arduino_ci.rb

Copy file name to clipboardExpand all lines: exe/arduino_ci.rb
+22-10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919

2020
# Use some basic parsing to allow command-line overrides of config
2121
class Parser
22+
23+
def self.show_help(opts)
24+
puts opts
25+
puts
26+
puts "Additionally, the following environment variables control the script:"
27+
puts " - #{VAR_CUSTOM_INIT_SCRIPT} - if set, this script will be run from the Arduino/libraries directory"
28+
puts " prior to any automated library installation or testing (e.g. to install unofficial libraries)"
29+
puts " - #{VAR_USE_SUBDIR} - if set, the script will install the library from this subdirectory of the cwd"
30+
puts " - #{VAR_EXPECT_EXAMPLES} - if set, testing will fail if no example sketches are present"
31+
puts " - #{VAR_EXPECT_UNITTESTS} - if set, testing will fail if no unit tests are present"
32+
end
33+
2234
def self.parse(options)
2335
unit_config = {}
2436
output_options = {
@@ -58,19 +70,19 @@ def self.parse(options)
5870
end
5971

6072
opts.on("-h", "--help", "Prints this help") do
61-
puts opts
62-
puts
63-
puts "Additionally, the following environment variables control the script:"
64-
puts " - #{VAR_CUSTOM_INIT_SCRIPT} - if set, this script will be run from the Arduino/libraries directory"
65-
puts " prior to any automated library installation or testing (e.g. to install unofficial libraries)"
66-
puts " - #{VAR_USE_SUBDIR} - if set, the script will install the library from this subdirectory of the cwd"
67-
puts " - #{VAR_EXPECT_EXAMPLES} - if set, testing will fail if no example sketches are present"
68-
puts " - #{VAR_EXPECT_UNITTESTS} - if set, testing will fail if no unit tests are present"
73+
show_help(opts)
6974
exit
7075
end
7176
end
7277

73-
opt_parser.parse!(options)
78+
begin
79+
opt_parser.parse!(options)
80+
rescue OptionParser::InvalidOption => e
81+
puts e
82+
puts
83+
show_help(opt_parser)
84+
exit 1
85+
end
7486
output_options
7587
end
7688
end
@@ -585,7 +597,7 @@ def perform_example_compilation_tests(cpp_library, config)
585597
#
586598

587599
# Read in command line options and make them read-only
588-
@cli_options = (Parser.parse ARGV).freeze
600+
@cli_options = Parser.parse(ARGV).freeze
589601

590602
@log = ArduinoCI::Logger.auto_width
591603
@log.banner

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.