diff --git a/rd-cli-tool/src/main/java/org/rundeck/client/tool/Main.java b/rd-cli-tool/src/main/java/org/rundeck/client/tool/Main.java index 8011c03c..db1f6cf9 100644 --- a/rd-cli-tool/src/main/java/org/rundeck/client/tool/Main.java +++ b/rd-cli-tool/src/main/java/org/rundeck/client/tool/Main.java @@ -367,13 +367,15 @@ public Rd(final ConfigValues src) { public boolean isAnsiEnabled() { String term = getString("TERM", null); - String rd_color = getString("RD_COLOR", null); - return "1".equals(rd_color) || - ( - term != null - && term.contains("color") - && !"0".equals(rd_color) - ); + String rdColor = getString("RD_COLOR", null); + + String noColor = getString("NO_COLOR", null); // https://no-color.org/ + boolean noColorFlag = noColor != null && !noColor.isEmpty(); + + boolean autoEnabled = term != null && term.contains("color"); + boolean enabled = "1".equals(rdColor); + boolean disabled = "0".equals(rdColor) || noColorFlag; + return enabled || (autoEnabled && !disabled); } @Override