Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

various: fix miscellaneous typos #879

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/thor/parser/options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def parse(args) # rubocop:disable Metrics/MethodLength
def check_exclusive!
opts = @assigns.keys
# When option A and B are exclusive, if A and B are given at the same time,
# the diffrence of argument array size will decrease.
# the difference of argument array size will decrease.
found = @exclusives.find{ |ex| (ex - opts).size < ex.size - 1 }
if found
names = names_to_switch_names(found & opts).map{|n| "'#{n}'"}
Expand Down Expand Up @@ -175,7 +175,7 @@ def check_unknown!

protected

# Option names changes to swith name or human name
# Option names changes to switch name or human name
def names_to_switch_names(names = [])
@switches.map do |_, o|
if names.include? o.name
Expand Down
12 changes: 6 additions & 6 deletions spec/parser/options_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@ def remaining
[["foo", "bar"], ["baz","qux"]])
end

it "raises an error if exclusive argumets are given" do
it "raises an error if exclusive arguments are given" do
expect{parse(%w[--foo --bar])}.to raise_error(Thor::ExclusiveArgumentError, "Found exclusive options '--foo', '--bar'")
end

it "does not raise an error if exclusive argumets are not given" do
it "does not raise an error if exclusive arguments are not given" do
expect{parse(%w[--foo --baz])}.not_to raise_error
end
end
Expand All @@ -277,7 +277,7 @@ def remaining
[], [["foo", "bar"], ["baz","qux"]])
end

it "raises an error if at least one of required argumet is not given" do
it "raises an error if at least one of required argument is not given" do
expect{parse(%w[--baz])}.to raise_error(Thor::AtLeastOneRequiredArgumentError, "Not found at least one of required options '--foo', '--bar'")
end

Expand All @@ -292,11 +292,11 @@ def remaining
[["foo", "bar"], ["baz","qux"]])
end

it "raises an error if exclusive argumets are given" do
it "raises an error if exclusive arguments are given" do
expect{parse(%w[--foo --bar])}.to raise_error(Thor::ExclusiveArgumentError, "Found exclusive options '--foo', '--bar'")
end

it "does not raise an error if exclusive argumets are not given" do
it "does not raise an error if exclusive arguments are not given" do
expect{parse(%w[--foo --baz])}.not_to raise_error
end
end
Expand All @@ -307,7 +307,7 @@ def remaining
[], [["foo", "bar"], ["baz","qux"]])
end

it "raises an error if at least one of required argumet is not given" do
it "raises an error if at least one of required argument is not given" do
expect{parse(%w[--baz])}.to raise_error(Thor::AtLeastOneRequiredArgumentError, "Not found at least one of required options '--foo', '--bar'")
end

Expand Down
2 changes: 1 addition & 1 deletion spec/thor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def shell
expect(content).not_to match(/Exclusive Options:/)
end

it "prints class at least one of requred options" do
it "prints class at least one of required options" do
content = capture(:stdout) { MyClassOptionScript.help(shell) }
expect(content).to match(/Required At Least One:\n\s+--three\s+--four\n/)
end
Expand Down