jdx / mise

dev tools, env vars, task runner
https://mise.jdx.dev
MIT License
9.97k stars 286 forks source link

mise ignores the environments `CLICOLOR_FORCE` #1836

Open yggdr opened 7 months ago

yggdr commented 7 months ago

Describe the bug Mise's documentation claims to respect the CLICOLOR and CLICOLOR_FORCE environment variables, and FORCE_COLOR according to code comments. But with the color setting set to false, it never outputs color.

To Reproduce

with __xonsh__.env.swap({'FORCE_COLOR': '1', 'CLICOLOR_FORCE': '1', 'CLICOLOR': '1'}):
......     ~/local/bin/mise ls
......     env | egrep "FORCE_COLOR|CLICOLOR"
......     echo $FORCE_COLOR $CLICOLOR $CLICOLOR_FORCE
......     
Plugin       Version  Config Source              Requested
atlas        0.20.0                                       
cidr-merger  1.1.3                                        
go           1.22.1                                       
python       2.7.18                                       
python       3.9.18                                       
python       3.11.8   MISE_PYTHON_VERSION=3.11.8 3.11.8   
zig          0.11.0                                       
FORCE_COLOR=1
CLICOLOR_FORCE=1
CLICOLOR=1
1 1 1

Goes similarly in other shells.

Expected behavior CLICOLOR_FORCE should make mise output color to stdout no matter what.

mise doctor output

version: 2024.3.9 freebsd-x64 (5186f29 2024-03-25)
activated: yes
shims_on_path: no

build_info: 
  Target: x86_64-unknown-freebsd
  Features: DEFAULT, NATIVE_TLS
  Built: Mon, 25 Mar 2024 18:45:24 +0000
  Rust Version: rustc 1.76.0 (07dca489a 2024-02-04) (built from a source tarball)
  Profile: release

shell: 
  xonsh
  xonsh/0.15.1

dirs: 
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/.cache/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files: 
  ~/.config/mise/config.toml

plugins: 
  atlas        https://github.com/pbr0ck3r/asdf-atlas.git#a2ed8f1
  bun          (core)
  cidr-merger  https://github.com/ORCID/asdf-cidr-merger.git#5522711
  deno         (core)
  go           (core)
  java         (core)
  node         (core)
  python       (core)
  ruby         (core)
  rust         https://github.com/code-lever/asdf-rust.git#95acf4f
  semgrep      https://github.com/brentjanderson/asdf-semgrep.git#13ff78b
  zig          https://github.com/cheetah/asdf-zig.git#4c6cb6f

toolset: 
  python@3.11.8  

env_vars: 
  MISE_SHELL=xonsh
  MISE_PYTHON_VERSION=3.11.8

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = false
  disable_default_shorthands = false
  disable_tools = []
  experimental = false
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_compile = false
  python_default_packages_file = "/home/yggdrasil/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

1 problems found:

1. shims are missing, run mise reshim to create them
   Missing shims: python-config, python3.11-config, python, 2to3, cidr-merger, 2to3-3.9, 2to3-3.11, pip3.9, zig, pydoc3.11, python3.11-gdb.py, python2-config, pydoc3.9, python2.7-gdb.py, python2, idle, python3.9-config, smtpd.py, python2.7-config, easy_install-2.7, pip2, idle3.9, idle3, pydoc, pip2.7, python3.11, gofmt, easy_install, pip3, python2.7, python3, go, python3.9-gdb.py, idle3.11, python3-config, pydoc3, atlas, pip3.11, pip, python3.9
jdx commented 7 months ago

if someone has some cycles to investigate, but we use console::colors_enabled() so figuring out if it's console or our code is where I would start. It does appear that doesn't respect FORCE_COLOR, so that may need to be added.

This is a bit strange because I recall fairly recently using these settings myself and it working.