Module: Dry::CLI::Help

Defined in:
lib/dry/cli/help.rb,
lib/dry/cli/help/text.rb,
lib/dry/cli/help/colors.rb,
lib/dry/cli/help/version.rb,
lib/dry/cli/help/terminal.rb,
lib/dry/cli/help/formatter.rb,
lib/dry/cli/help/integration.rb,
lib/dry/cli/help/screens/base.rb,
lib/dry/cli/help/configuration.rb,
lib/dry/cli/help/screens/command.rb,
lib/dry/cli/help/screens/listing.rb,
sig/dry/cli/help.rbs

Overview

Configurable, wrapped and colored help screens for dry-cli.

Requiring this file changes the help every Dry::CLI in the process prints. Every setting is made once, in Help.configure, so the way dry-cli declares registries, commands and options stays exactly as dry-cli ships it.

Defined Under Namespace

Modules: Colors, Integration, Screens, Terminal, Text Classes: Configuration, Formatter

Constant Summary collapse

VERSION =

Returns:

  • (String)
"0.5.1"

Class Method Summary collapse

Class Method Details

.config ⇒ Configuration

Returns the process-wide settings.

Returns:



42
43
44
# File 'lib/dry/cli/help.rb', line 42

def config
  @config ||= Configuration.new
end

.config_for ⇒ Configuration

Parameters:

  • registry (Object)

Returns:



9
# File 'sig/dry/cli/help.rbs', line 9

def self.config_for: (untyped registry) -> Configuration

.configure {|arg0| ... } ⇒ Configuration

Make every setting. A block taking an argument receives the configuration; any other block runs against it.

Examples:

Dry::CLI::Help.configure do
  title "MyCLI"
  styles { heading :bold, :blue }
end

Yields:

Yield Parameters:

Yield Returns:

  • (void)

Returns:



36
37
38
39
# File 'lib/dry/cli/help.rb', line 36

def configure(&block)
  block.arity == 1 ? yield(config) : config.instance_eval(&block)
  config
end

.reset! ⇒ void

This method returns an undefined value.

Forget every process-wide setting.



48
49
50
# File 'lib/dry/cli/help.rb', line 48

def reset!
  @config = nil
end