-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
91 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
name: optarg | ||
version: 0.5.4 | ||
version: 0.5.5 | ||
|
||
authors: | ||
- mosop | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
require "../spec_helper" | ||
|
||
module OptargInternalSpec::Unknown | ||
class Model < Optarg::Model | ||
string "-s" | ||
unknown | ||
end | ||
|
||
describe name do | ||
it "with option" do | ||
result = Model.parse(%w(-s foo bar)) | ||
result.s?.should eq "foo" | ||
result.unparsed_args.should eq %w(bar) | ||
end | ||
|
||
it "without different option" do | ||
result = Model.parse(%w(-b foo bar)) | ||
result.unparsed_args.should eq %w(-b foo bar) | ||
end | ||
|
||
it "without option" do | ||
result = Model.parse(%w(foo bar)) | ||
result.unparsed_args.should eq %w(foo bar) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module Optarg::Definitions | ||
class Unknown < Base | ||
def initialize(metadata = nil) | ||
super "@unknown", metadata: metadata, unknown: true | ||
end | ||
|
||
def completion_length(gen) | ||
1 | ||
end | ||
|
||
def completion_max_occurs(gen) | ||
1 | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module Optarg | ||
class Model | ||
# Defines an unknown model item. | ||
macro unknown(metadata = nil) | ||
%unknown = ::Optarg::Definitions::Unknown.new(metadata: {{metadata}}) | ||
@@__klass.definitions << %unknown | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
module Optarg | ||
VERSION = "0.5.4" | ||
VERSION = "0.5.5" | ||
end |