Class: Git::Commands::ConfigOptionSyntax::Add Private

Inherits:
Base
  • Object
show all
Defined in:
lib/git/commands/config_option_syntax/add.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

Append a value to a multi-valued config key

Wraps git config --add to add a new line to a config key without altering existing values.

Examples:

Add a value to a multi-valued key

cmd = Git::Commands::ConfigOptionSyntax::Add.new(lib)
cmd.call('remote.origin.fetch', '+refs/heads/*:refs/remotes/origin/*')

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, value, **options) ⇒ Git::CommandLineResult

Execute the git config --add command

Parameters:

  • name (String)

    the config key name

  • value (String)

    the value to append

  • options (Hash)

    command options

Options Hash (**options):

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

    write to global config (~/.gitconfig)

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

    write to system config

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

    write to repository config (.git/config)

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

    write to worktree config

  • :file (String) — default: nil

    write to the specified file

    Alias: :f

  • :blob (String) — default: nil

    read from the specified blob

  • :type (String) — default: nil

    ensure the value conforms to the given type

Returns:

Raises:

  • (ArgumentError)

    if unsupported options are provided

  • (Git::FailedError)

    if git exits with a non-zero exit status



# File 'lib/git/commands/config_option_syntax/add.rb', line 47