Module: Clack::Core::CiMode

Defined in:
lib/clack/core/ci_mode.rb

Overview

Non-interactive mode for CI environments and piped input.

When enabled, prompts auto-submit with their default values instead of waiting for user input. Useful for CI pipelines, automated testing, and scripted usage where stdin isn’t a TTY.

Enable explicitly:

Clack.update_settings(ci_mode: true)

Or auto-detect (non-TTY stdin or CI environment variable):

Clack.update_settings(ci_mode: :auto)

Class Method Summary collapse

Class Method Details

.active?Boolean

Check if CI mode is currently active.

Returns:

  • (Boolean)


21
22
23
24
25
26
27
28
29
30
31
# File 'lib/clack/core/ci_mode.rb', line 21

def active?
  setting = Settings.config[:ci_mode]
  case setting
  when true
    true
  when :auto
    !Environment.tty?($stdin) || Environment.ci?
  else
    false
  end
end