Skip to content

Commit 557464c

Browse files
committed
simplify
1 parent 1eb9c7e commit 557464c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+940
-1026
lines changed

spec/internal/arg_array_title_spec.cr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ module CliInternalArgArrayTitleFeature
1414
end
1515

1616
it name do
17-
Command::Help::Class.instance.default_title.should eq "command [NAME1 NAME2...]"
18-
WithMin::Help::Class.instance.default_title.should eq "with-min NAME1 NAME2 NAME3 [NAME4 NAME5...]"
17+
Command.klass.default_title.should eq "command [NAME1 NAME2...]"
18+
WithMin.klass.default_title.should eq "with-min NAME1 NAME2 NAME3 [NAME4 NAME5...]"
1919
end
2020
end

spec/internal/custom_command_name_spec.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ module CliInternalCustomCommandNameFeature
66
end
77

88
it name do
9-
Command::Class.instance.global_name.should eq "custom"
9+
Command.klass.global_name.should eq "custom"
1010
end
1111
end

spec/internal/default_help_title_spec.cr

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ module CliInternalDefaultHelpTitleFeature
3838
end
3939

4040
it name do
41-
Optional::Help::Class.instance.default_title.should eq "optional [OPTIONS]"
42-
Required::Help::Class.instance.default_title.should eq "required OPTIONS"
43-
OptionalArg::Help::Class.instance.default_title.should eq "optional-arg [ARG]"
44-
RequiredArg::Help::Class.instance.default_title.should eq "required-arg ARG"
45-
Supercommand::Help::Class.instance.default_title.should eq "supercommand SUBCOMMAND"
46-
SupercommandWithDefault::Help::Class.instance.default_title.should eq "supercommand-with-default [SUBCOMMAND]"
41+
Optional.klass.default_title.should eq "optional [OPTIONS]"
42+
Required.klass.default_title.should eq "required OPTIONS"
43+
OptionalArg.klass.default_title.should eq "optional-arg [ARG]"
44+
RequiredArg.klass.default_title.should eq "required-arg ARG"
45+
Supercommand.klass.default_title.should eq "supercommand SUBCOMMAND"
46+
SupercommandWithDefault.klass.default_title.should eq "supercommand-with-default [SUBCOMMAND]"
4747
end
4848
end

spec/internal/dynamic_validation_spec.cr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ module CliInternalDynamicValidationFeature
55

66
class Command < Cli::Command
77
class Options
8-
arg_array "name" do |definition|
9-
definition.on_validate do |context|
10-
context.validate_element_inclusion context.command.expected
11-
end
12-
end
8+
# arg_array "name" do |definition|
9+
# definition.on_validate do |context|
10+
# context.validate_element_inclusion context.command.expected
11+
# end
12+
# end
1313
end
1414

1515
def expected
@@ -19,19 +19,19 @@ module CliInternalDynamicValidationFeature
1919

2020
class Command2 < Cli::Command
2121
class Options
22-
arg_array "name" do |definition|
23-
definition.on_validate do |context|
24-
context.validate_element_inclusion context.command.expected2
25-
end
26-
end
22+
# arg_array "name" do |definition|
23+
# definition.on_validate do |context|
24+
# context.validate_element_inclusion context.command.expected2
25+
# end
26+
# end
2727
end
2828

2929
def expected2
3030
%w(foo bar baz)
3131
end
3232
end
3333

34-
it name do
34+
pending name do
3535
Command.run(%w(other)).should exit_command(error: /^Parsing Error: /)
3636
Command2.run(%w(other)).should exit_command(error: /^Parsing Error: /)
3737
end

spec/internal/recursive_run_spec.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module CliInternalRecursiveRunFeature
99
end
1010

1111
def run
12-
run Command
12+
Command.run self
1313
end
1414
end
1515

spec/internal/three_level_command_name_spec.cr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ module CliInternalThreeLevelCommandNameFeature
1717
end
1818

1919
it name do
20-
One::Commands::Two::Commands::Three::Class.instance.global_name.should eq "one two three"
20+
One::Commands::Two::Commands::Three.klass.global_name.should eq "one two three"
2121
end
2222
end

src/cli.cr

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
require "optarg"
2-
require "string_inflection/kebab"
3-
require "string_inflection/snake"
4-
require "./cli/macros/*"
5-
require "./cli/*"
6-
require "./cli/command_class/*"
7-
require "./cli/helps/*"
8-
require "./cli/ios/*"
9-
require "./cli/option_model/*"
10-
require "./cli/option_model_definitions/*"
11-
require "./cli/util/*"
1+
require "./lib"
122

133
module Cli
144
def self.env

0 commit comments

Comments
 (0)