command_kit.rb
command_kit.rb copied to clipboard
Port to Crystal
The ModuleMethods vs ClassMethods code can be ported to Crystal as nested macros:
module Mixin1
module ClassMethods
def foo
puts "foo"
end
end
module ModuleMethods
macro extended
macro included
\{% if @type.module? %}
extend ModuleMethods
\{% else %}
extend ClassMethods
\{% end %}
end
end
end
extend ModuleMethods
end
module Mixin2
include Mixin1
end
module Mixin3
include Mixin2
end
class Foo
include Mixin3
end
Foo.foo
# => foo
Since Crystal is compiled, we won't be able to port CommandKit::Commands::AutoLoad or CommandKit::Commands::AutoRequire.
Crystal does not currently support an equivalent to IO.winsize. We may have to add it as an extension to LibC (ex: ioctl.cr and C equivalent)