Class: Git::Commands::ConfigOptionSyntax::RemoveSection Private

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

Remove a config section

Wraps git config --remove-section to remove an entire section from the config file.

Examples:

Remove a section

cmd = Git::Commands::ConfigOptionSyntax::RemoveSection.new(lib)
cmd.call('old-section')

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

Execute the git config --remove-section command

Parameters:

  • name (String)

    the section name to remove

  • options (Hash)

    command options

Options Hash (**options):

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

    remove from global config (~/.gitconfig)

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

    remove from system config

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

    remove from repository config (.git/config)

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

    remove from worktree config

  • :file (String) — default: nil

    remove from the specified file

    Alias: :f

  • :blob (String) — default: nil

    read from the specified blob

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/remove_section.rb', line 42