Class: Git::Commands::ConfigOptionSyntax::GetColorBool Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/config_option_syntax/get_color_bool.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Note:

arguments block audited against https://git-scm.com/docs/git-config/2.53.0

Query whether color output is enabled for a config key

Wraps git config --get-colorbool to check whether color output should be used. This command has no subcommand equivalent even in git 2.46.0 — it exists only in the option-syntax interface.

Examples:

Query whether color is enabled for diff

cmd = Git::Commands::ConfigOptionSyntax::GetColorBool.new(lib)
cmd.call('color.diff')

Query with explicit stdout-is-tty hint

cmd = Git::Commands::ConfigOptionSyntax::GetColorBool.new(lib)
cmd.call('color.diff', 'true')

See Also:

Instance Method Summary collapse

Methods inherited from Base

allow_exit_status, arguments, #initialize, requires_git_version, skip_version_validation

Constructor Details

This class inherits a constructor from Git::Commands::Base

Instance Method Details

#call(name, stdout_is_tty = nil, **options) ⇒ Git::CommandLineResult

Execute the git config --get-colorbool command

Parameters:

  • name (String)

    the color config key name to query

  • stdout_is_tty (String, nil) (defaults to: nil)

    (nil) hint whether stdout is a TTY ("true" or "false")

  • options (Hash)

    command options

Options Hash (**options):

  • :global (Boolean, nil) — default: nil

    read from global config (~/.gitconfig)

  • :system (Boolean, nil) — default: nil

    read from system config

  • :local (Boolean, nil) — default: nil

    read from repository config (.git/config)

  • :worktree (Boolean, nil) — default: nil

    read from worktree config

  • :file (String) — default: nil

    read from the specified file

    Alias: :f

  • :blob (String) — default: nil

    read from the specified blob

  • :includes (Boolean, nil) — default: nil

    respect include directives in config files (--includes)

  • :no_includes (Boolean, nil) — default: nil

    disable include directive processing (--no-includes)

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits outside the allowed range (exit code > 1)



# File 'lib/git/commands/config_option_syntax/get_color_bool.rb', line 55