流浪汉 - 没有颜色,它做什么?

时间:2013-10-30 17:20:42

标签: chef vagrant

我正在学习厨师,并从一个厨师教程页面找到了这个命令。

https://learnchef.opscode.com/quickstart/converge/

我知道流浪汉是什么。但是 - 没有颜色,我不知道这是为了什么。我搜索了整个流浪网站。仍然找不到它。

只是好奇这是什么。

1 个答案:

答案 0 :(得分:8)

--no-color只是禁用彩色的Vagrant输出。

目前似乎没有记录,但搜索Vagrant Github repo会显示以下内容:

bin/vagrant

# Disable color in a few cases:
#
# * --no-color is anywhere in our arguments
# * STDOUT is not a TTY
# * The terminal doesn't support colors (Windows)
#
if ARGV.include?("--no-color")
  # Delete the argument from the list so that it doesn't
  # cause any invalid arguments down the road.
  ARGV.delete("--no-color")

  opts[:ui_class] = Vagrant::UI::Basic
elsif !Vagrant::Util::Platform.terminal_supports_colors?
  opts[:ui_class] = Vagrant::UI::Basic
elsif !$stdout.tty? && !Vagrant::Util::Platform.cygwin?
  # Cygwin always reports STDOUT is not a TTY, so we only disable
  # colors if its not a TTY AND its not Cygwin.
  opts[:ui_class] = Vagrant::UI::Basic
end
相关问题