Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/components/clock/src/athena-clock.cr
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Athena::Clock

def initialize(
@clock : ACLK::Interface? = nil,
@location : Time::Location? = nil
@location : Time::Location? = nil,
)
end

Expand Down
2 changes: 1 addition & 1 deletion src/components/clock/src/monotonic.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Athena::Clock::Monotonic
@nanosecond_offset : Int128

def initialize(
location : Time::Location? = nil
location : Time::Location? = nil,
)
@location = location || Time::Location.local
@nanosecond_offset = Time.utc.to_unix_ns - Time.monotonic.total_nanoseconds.to_i128
Expand Down
2 changes: 1 addition & 1 deletion src/components/clock/src/native.cr
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct Athena::Clock::Native
@location : Time::Location

def initialize(
location : Time::Location? = nil
location : Time::Location? = nil,
)
@location = location || Time::Location.local
end
Expand Down
2 changes: 1 addition & 1 deletion src/components/clock/src/spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module Athena::Clock::Spec

def initialize(
now : Time = Time.local,
location : Time::Location? = nil
location : Time::Location? = nil,
)
@location = location || Time::Location::UTC
@now = now.in @location
Expand Down
14 changes: 7 additions & 7 deletions src/components/console/spec/application_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct ApplicationTest < ASPEC::TestCase
commands.size.should eq 1

app.command_loader = ACON::Loader::Factory.new({
"foo:bar1" => ->{ Foo1Command.new.as ACON::Command },
"foo:bar1" => -> { Foo1Command.new.as ACON::Command },
})
commands = app.commands "foo"
commands.size.should eq 2
Expand Down Expand Up @@ -112,7 +112,7 @@ struct ApplicationTest < ASPEC::TestCase
app.get("afoobar").should be foo

app.command_loader = ACON::Loader::Factory.new({
"foo:bar1" => ->{ Foo1Command.new.as ACON::Command },
"foo:bar1" => -> { Foo1Command.new.as ACON::Command },
})

app.has?("afoobar").should be_true
Expand Down Expand Up @@ -258,7 +258,7 @@ struct ApplicationTest < ASPEC::TestCase
app = ACON::Application.new "foo"

app.command_loader = ACON::Loader::Factory.new({
"foo:bar" => ->{ FooCommand.new.as ACON::Command },
"foo:bar" => -> { FooCommand.new.as ACON::Command },
})

app.find("foo:bar").should be_a FooCommand
Expand Down Expand Up @@ -479,7 +479,7 @@ struct ApplicationTest < ASPEC::TestCase

app = ACON::Application.new "foo"
app.command_loader = ACON::Loader::Factory.new({
"foo3" => ->{ foo_command.as ACON::Command },
"foo3" => -> { foo_command.as ACON::Command },
})
app.add foo_command

Expand Down Expand Up @@ -1048,12 +1048,12 @@ struct ApplicationTest < ASPEC::TestCase
loaded = Hash(String, Bool).new

app.command_loader = ACON::Loader::Factory.new({
"foo:bar" => ->do
"foo:bar" => -> do
loaded["foo:bar"] = true

ACON::Commands::Generic.new("foo:bar") { ACON::Command::Status::SUCCESS }.as ACON::Command
end,
"foo" => ->do
"foo" => -> do
loaded["foo"] = true

ACON::Commands::Generic.new("foo") { ACON::Command::Status::SUCCESS }.as ACON::Command
Expand All @@ -1069,7 +1069,7 @@ struct ApplicationTest < ASPEC::TestCase
app = ACON::Application.new "foo"

app.command_loader = ACON::Loader::Factory.new({
"foo" => ->{ ACON::Commands::Generic.new("bar") { ACON::Command::Status::SUCCESS }.as ACON::Command },
"foo" => -> { ACON::Commands::Generic.new("bar") { ACON::Command::Status::SUCCESS }.as ACON::Command },
})

expect_raises ACON::Exception::CommandNotFound, "The 'foo' command cannot be found because it is registered under multiple names. Make sure you don't set a different name via constructor or 'name='." do
Expand Down
2 changes: 1 addition & 1 deletion src/components/console/spec/commands/complete_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ struct CompleteCommandTest < ASPEC::TestCase

def test_completes_command_name_with_loader : Nil
@application.command_loader = ACON::Loader::Factory.new({
"foo:bar1" => ->{ Foo1Command.new.as ACON::Command },
"foo:bar1" => -> { Foo1Command.new.as ACON::Command },
})

self.execute({"--current" => "0", "--input" => [] of String})
Expand Down
4 changes: 2 additions & 2 deletions src/components/console/spec/commands/lazy_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ end

describe ACON::Commands::Lazy do
it "applies metadata to the instantiated command" do
lazy_command = ACON::Commands::Lazy.new "cmd_name", ["foo", "bar"], "description", true, ->{ MockCommand.new.as ACON::Command }
lazy_command = ACON::Commands::Lazy.new "cmd_name", ["foo", "bar"], "description", true, -> { MockCommand.new.as ACON::Command }
command = lazy_command.command

command.should be_a MockCommand
Expand All @@ -22,7 +22,7 @@ describe ACON::Commands::Lazy do
it "forwards methods to the wrapped command instance" do
mock_command = MockCommand.new

lazy_command = ACON::Commands::Lazy.new "cmd_name", ["foo", "bar"], "description", true, ->{ mock_command.as ACON::Command }
lazy_command = ACON::Commands::Lazy.new "cmd_name", ["foo", "bar"], "description", true, -> { mock_command.as ACON::Command }
command = lazy_command.command

command.helper_set = ACON::Helper::HelperSet.new ACON::Helper::Question.new
Expand Down
2 changes: 1 addition & 1 deletion src/components/console/spec/spec_helper.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ struct MockCommandLoader
*,
@command_or_exception : ACON::Command | ::Exception? = nil,
@has : Bool = true,
@names : Array(String) | ::Exception = [] of String
@names : Array(String) | ::Exception = [] of String,
)
end

Expand Down
4 changes: 2 additions & 2 deletions src/components/console/src/command.cr
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ abstract class Athena::Console::Command
mode : ACON::Input::Argument::Mode = :optional,
description : String = "",
default = nil,
suggested_values : Enumerable(String)? = nil
suggested_values : Enumerable(String)? = nil,
) : self
@definition << ACON::Input::Argument.new name, mode, description, default, suggested_values.try &.to_a

Expand Down Expand Up @@ -401,7 +401,7 @@ abstract class Athena::Console::Command
value_mode : ACON::Input::Option::Value = :none,
description : String = "",
default = nil,
suggested_values : Enumerable(String)? = nil
suggested_values : Enumerable(String)? = nil,
) : self
@definition << ACON::Input::Option.new name, shortcut, value_mode, description, default, suggested_values.try &.to_a

Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/commands/lazy.cr
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Athena::Console::Commands::Lazy < Athena::Console::Command
description : String,
hidden : Bool,
@command : Proc(ACON::Command),
@enabled : Bool = true
@enabled : Bool = true,
)
self
.name(name)
Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/descriptor/context.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Athena::Console::Descriptor::Context
@raw_output : Bool? = nil,
@namespace : String? = nil,
@total_width : Int32? = nil,
@short : Bool = false
@short : Bool = false,
)
end

Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/helper/progress_bar.cr
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ class Athena::Console::Helper::ProgressBar
minimum_seconds_between_redraws : Float64 = 0.04,

# Use a monotonic clock by default since its better for measuring time
@clock : ACLK::Interface = ACLK::Monotonic.new
@clock : ACLK::Interface = ACLK::Monotonic.new,
)
if output.is_a? ACON::Output::ConsoleOutputInterface
output = output.error_output
Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/helper/progress_indicator.cr
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class Athena::Console::Helper::ProgressIndicator
indicator_values : Indexable(String)? = nil,

# Use a monotonic clock by default since its better for measuring time
@clock : ACLK::Interface = ACLK::Monotonic.new
@clock : ACLK::Interface = ACLK::Monotonic.new,
)
indicator_values ||= ["-", "\\", "|", "/"]

Expand Down
4 changes: 2 additions & 2 deletions src/components/console/src/helper/table.cr
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ class Athena::Console::Helper::Table
value : _ = "",
@rowspan : Int32 = 1,
@colspan : Int32 = 1,
@style : Table::CellStyle? = nil
@style : Table::CellStyle? = nil,
)
@value = value.to_s
end
Expand All @@ -496,7 +496,7 @@ class Athena::Console::Helper::Table
def initialize(
rowspan : Int32 = 1,
colspan : Int32 = 1,
style : Table::CellStyle? = nil
style : Table::CellStyle? = nil,
)
super "", rowspan, colspan, style
end
Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/helper/table_cell_style.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct Athena::Console::Helper::Table::CellStyle
@foreground : String = "default",
@background : String = "default",
@align : ACON::Helper::Table::Alignment = :left,
@format : String? = nil
@format : String? = nil,
)
end

Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/helper/table_style.cr
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class Athena::Console::Helper::Table::Style
middle_left : String | Char,
top_left_bottom : String | Char | Nil = nil,
top_middle_bottom : String | Char | Nil = nil,
top_right_bottom : String | Char | Nil = nil
top_right_bottom : String | Char | Nil = nil,
) : self
@crossing_char = cross.to_s
@crossing_top_left_char = top_left.to_s
Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/input/argument.cr
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Athena::Console::Input::Argument
@mode : ACON::Input::Argument::Mode = :optional,
@description : String = "",
default = nil,
@suggested_values : Array(String) | Proc(ACON::Completion::Input, Array(String)) | Nil = nil
@suggested_values : Array(String) | Proc(ACON::Completion::Input, Array(String)) | Nil = nil,
)
raise ACON::Exception::InvalidArgument.new "An argument name cannot be blank." if name.blank?

Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/input/option.cr
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class Athena::Console::Input::Option
@value_mode : ACON::Input::Option::Value = :none,
@description : String = "",
default = nil,
@suggested_values : Array(String) | Proc(ACON::Completion::Input, Array(String)) | Nil = nil
@suggested_values : Array(String) | Proc(ACON::Completion::Input, Array(String)) | Nil = nil,
)
@name = name.lchop "--"

Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/output/console_output.cr
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class Athena::Console::Output::ConsoleOutput < Athena::Console::Output::IO
def initialize(
verbosity : ACON::Output::Verbosity = :normal,
decorated : Bool? = nil,
formatter : ACON::Formatter::Interface? = nil
formatter : ACON::Formatter::Interface? = nil,
)
super STDOUT, verbosity, decorated, formatter

Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/output/io.cr
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Athena::Console::Output::IO < Athena::Console::Output
@io : ::IO,
verbosity : ACON::Output::Verbosity? = :normal,
decorated : Bool? = nil,
formatter : ACON::Formatter::Interface? = nil
formatter : ACON::Formatter::Interface? = nil,
)
decorated = self.has_color_support? if decorated.nil?

Expand Down
4 changes: 2 additions & 2 deletions src/components/console/src/output/output.cr
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ abstract class Athena::Console::Output
def initialize(
verbosity : ACON::Output::Verbosity? = :normal,
decorated : Bool = false,
formatter : ACON::Formatter::Interface? = nil
formatter : ACON::Formatter::Interface? = nil,
)
@verbosity = verbosity || ACON::Output::Verbosity::NORMAL
@formatter = formatter || ACON::Formatter::Output.new
Expand Down Expand Up @@ -79,7 +79,7 @@ abstract class Athena::Console::Output
message : String | Enumerable(String),
new_line : Bool,
verbosity : ACON::Output::Verbosity,
output_type : ACON::Output::Type
output_type : ACON::Output::Type,
)
messages = message.is_a?(String) ? {message} : message

Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/output/section.cr
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Athena::Console::Output::Section < Athena::Console::Output::IO
@sections : Array(self),
verbosity : ACON::Output::Verbosity,
decorated : Bool,
formatter : ACON::Formatter::Interface
formatter : ACON::Formatter::Interface,
)
super io, verbosity, decorated, formatter

Expand Down
2 changes: 1 addition & 1 deletion src/components/console/src/output/sized_buffer.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Athena::Console::Output::SizedBuffer < Athena::Console::Output
@max_length : Int32,
verbosity : ACON::Output::Verbosity? = :normal,
decorated : Bool = false,
formatter : ACON::Formatter::Interface? = nil
formatter : ACON::Formatter::Interface? = nil,
)
if @max_length < 0
raise ACON::Exception::InvalidArgument.new "'#{self.class}#max_length' must be a positive, got: '#{@max_length}'."
Expand Down
10 changes: 5 additions & 5 deletions src/components/console/src/spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module Athena::Console::Spec
decorated : Bool? = nil,
interactive : Bool? = nil,
verbosity : ACON::Output::Verbosity? = nil,
@capture_stderr_separately : Bool = false
@capture_stderr_separately : Bool = false,
) : Nil
if !@capture_stderr_separately
@output = ACON::Output::IO.new IO::Memory.new
Expand Down Expand Up @@ -126,7 +126,7 @@ module Athena::Console::Spec
interactive : Bool? = nil,
capture_stderr_separately : Bool = false,
verbosity : ACON::Output::Verbosity? = nil,
**input : _
**input : _,
)
self.run input.to_h.transform_keys(&.to_s), decorated: decorated, interactive: interactive, capture_stderr_separately: capture_stderr_separately, verbosity: verbosity
end
Expand All @@ -138,7 +138,7 @@ module Athena::Console::Spec
decorated : Bool? = nil,
interactive : Bool? = nil,
capture_stderr_separately : Bool = false,
verbosity : ACON::Output::Verbosity? = nil
verbosity : ACON::Output::Verbosity? = nil,
) : ACON::Command::Status
@input = ACON::Input::Hash.new input

Expand Down Expand Up @@ -272,7 +272,7 @@ module Athena::Console::Spec
interactive : Bool? = nil,
capture_stderr_separately : Bool = false,
verbosity : ACON::Output::Verbosity? = nil,
**input : _
**input : _,
)
self.execute input.to_h.transform_keys(&.to_s), decorated: decorated, interactive: interactive, capture_stderr_separately: capture_stderr_separately, verbosity: verbosity
end
Expand All @@ -284,7 +284,7 @@ module Athena::Console::Spec
decorated : Bool = false,
interactive : Bool? = nil,
capture_stderr_separately : Bool = false,
verbosity : ACON::Output::Verbosity? = nil
verbosity : ACON::Output::Verbosity? = nil,
) : ACON::Command::Status
if !input.has_key?("command") && (application = @command.application?) && application.definition.has_argument?("command")
input = input.merge({"command" => @command.name})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class OptionalClient
def initialize(
@service_missing : OptionalMissingService?,
@service_existing : OptionalExistingService?,
@service_default : OptionalMissingService | Int32 | Nil = 12
@service_default : OptionalMissingService | Int32 | Nil = 12,
); end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ParametersClient
array : Array(String),
nested_array : Array(Array(String) | String),
nested_hash : Hash(String, Bool | String | Array(String) | Array(Array(String) | String)),
non_string : Bool
non_string : Bool,
)
reference.should eq "google.com"
with_percent.should eq "foo%bar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class PartnerNamedDefaultClient

def initialize(
@services : Array(FeedPartner),
@status : Status = Status::Active
@status : Status = Status::Active,
)
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class BindingsPriorityClient
id : Int64, # Ann has highest priority
name : String, # Global bind 2nd highest priority
alive : Bool, # Autoconfigure lowest priority
value : Float32
value : Float32,
)
id.should eq 30
name.should eq "Fred"
Expand Down Expand Up @@ -57,7 +57,7 @@ class BindingsClient
service_hash : Hash(String, SomeClassService | SomeStructService),
service_array : Array(SomeClassService | SomeStructService),
value : Float64,
proxy_service : ADI::Proxy(SomeStructService)
proxy_service : ADI::Proxy(SomeStructService),
)
some_service.value.should eq 123
some_parameter.should eq "google.com"
Expand All @@ -72,7 +72,7 @@ end
class Bindings2Client
def initialize(
value,
proxy_service : SomeStructService
proxy_service : SomeStructService,
)
value.should eq 88
proxy_service.should eq SomeStructService.new
Expand Down
Loading