Class: Git::Commands::ConfigOptionSyntax::RenameSection Private

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

Rename a config section

Wraps git config --rename-section to rename a section in the config file.

Examples:

Rename a section

cmd = Git::Commands::ConfigOptionSyntax::RenameSection.new(lib)
cmd.call('old-section', 'new-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(old_name, new_name, **options) ⇒ Git::CommandLineResult

Execute the git config --rename-section command

Parameters:

  • old_name (String)

    the current section name

  • new_name (String)

    the new section name

  • options (Hash)

    command options

Options Hash (**options):

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

    operate on global config (~/.gitconfig)

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

    operate on system config

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

    operate on repository config (.git/config)

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

    operate on worktree config

  • :file (String) — default: nil

    operate on 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/rename_section.rb', line 44