File tree Expand file tree Collapse file tree 4 files changed +32
-3
lines changed
Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 11name : cli
2- version : 0.6.4
2+ version : 0.6.5
33
44authors :
55 - mosop
@@ -9,7 +9,7 @@ crystal: 0.20.5
99dependencies :
1010 optarg :
1111 github : mosop/optarg
12- version : ~> 0.5.4
12+ version : ~> 0.5.5
1313 string_inflection :
1414 github : mosop/string_inflection
1515 version : ~> 0.2.0
Original file line number Diff line number Diff line change 1+ require " ../spec_helper"
2+
3+ module CliInternalSpecs::UnknownOptionModelItem
4+ class Command < Cli::Command
5+ class Options
6+ string " -s"
7+ unknown
8+ end
9+
10+ def run
11+ puts options.s?
12+ puts unparsed_args.join(" " )
13+ end
14+ end
15+
16+ it name do
17+ Command .run(%w(foo bar baz) ) do |cmd |
18+ cmd.out.gets_to_end.chomp.should eq " \n foo bar baz"
19+ end
20+ Command .run(%w(-s foo bar baz) ) do |cmd |
21+ cmd.out.gets_to_end.chomp.should eq " foo\n bar baz"
22+ end
23+ end
24+ end
Original file line number Diff line number Diff line change @@ -65,6 +65,11 @@ class Cli::OptionModel
6565 ::Optarg ::Model .on({{names}}, metadata: ::Cli ::OptionMetadata .new(description: {{desc}})) {{block}}
6666 end
6767
68+ # Defines an unknown model item.
69+ macro unknown (desc = nil , & block )
70+ ::Optarg ::Model .unknown(metadata: ::Cli ::OptionMetadata .new(description: {{desc}})) {{block}}
71+ end
72+
6873 # Defines a handler model item for printing a help message.
6974 macro help (names = nil , desc = nil )
7075 {%
Original file line number Diff line number Diff line change 11module Cli
2- VERSION = " 0.6.4 "
2+ VERSION = " 0.6.5 "
33end
You can’t perform that action at this time.
0 commit comments