Skip to content

Commit

Permalink
Only colorize tty
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragmaanir committed Oct 3, 2023
1 parent 0eaa4af commit 0ad2f06
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/kommando.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ require "./kommando/docker"
require "./kommando/command"
require "./kommando/namespace"

Colorize.on_tty_only!

module Kommando
ROOT = Path.new(__DIR__).parent

Expand Down
5 changes: 3 additions & 2 deletions src/kommando/command.cr
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,8 @@ module Kommando
{% for v in @type.instance_vars %}
{% name = v.name.id %}
{% if ann = v.annotation(Kommando::Option) %}
{% default = ann.named_args[:default] %}
{% a = ann.named_args %}
{% default = a[:default] %}

%value = options[:{{name}}]?

Expand All @@ -294,7 +295,7 @@ module Kommando
case %v = %value
when nil
else
{{ann.named_args[:validate]}}.call(%v)
{{a[:validate]}}.call(%v)
@{{name}} = %v
end
{% end %}
Expand Down

0 comments on commit 0ad2f06

Please sign in to comment.