From 0ad2f066ebf96ae519cbbda7277df3f12b50246f Mon Sep 17 00:00:00 2001 From: Ragmaanir Date: Tue, 3 Oct 2023 03:38:21 +0200 Subject: [PATCH] Only colorize tty --- src/kommando.cr | 2 ++ src/kommando/command.cr | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/kommando.cr b/src/kommando.cr index 01ecc06..50769bc 100644 --- a/src/kommando.cr +++ b/src/kommando.cr @@ -6,6 +6,8 @@ require "./kommando/docker" require "./kommando/command" require "./kommando/namespace" +Colorize.on_tty_only! + module Kommando ROOT = Path.new(__DIR__).parent diff --git a/src/kommando/command.cr b/src/kommando/command.cr index 5cbc724..c341906 100644 --- a/src/kommando/command.cr +++ b/src/kommando/command.cr @@ -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}}]? @@ -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 %}