Skip to content

Commit

Permalink
Merge pull request #1208 from Shopify/uk-unknown-options
Browse files Browse the repository at this point in the history
Show error and fail early for unknown options
  • Loading branch information
paracycle authored Oct 4, 2022
2 parents f0e9432 + 720ee64 commit 8a89d06
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/tapioca/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class Cli < Thor

FILE_HEADER_OPTION_DESC = "Add a \"This file is generated\" header on top of each generated RBI file"

check_unknown_options!

class_option :config,
aliases: ["-c"],
banner: "<config file path>",
Expand Down
12 changes: 12 additions & 0 deletions spec/tapioca/cli/dsl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,18 @@ def self.application
RB
end

it "shows an error message for unknown options" do
result = @project.tapioca("dsl --unknown-option")

assert_empty_stdout(result)

assert_equal(<<~ERR, result.err)
Unknown switches "--unknown-option"
ERR

refute_success_status(result)
end

describe "generate" do
before(:all) do
@project.require_real_gem("smart_properties", "1.15.0")
Expand Down

0 comments on commit 8a89d06

Please sign in to comment.