class Git::Commands::ConfigOptionSyntax::Get
Retrieve a single config value by exact key name
Wraps ‘git config –get` to return the value of the last-matching config entry for the given key name.
@example Get a local config value
cmd = Git::Commands::ConfigOptionSyntax::Get.new(lib) cmd.call('user.name')
@example Get a global config value
cmd = Git::Commands::ConfigOptionSyntax::Get.new(lib) cmd.call('user.name', global: true)
@example Get a value with a type constraint
cmd = Git::Commands::ConfigOptionSyntax::Get.new(lib) cmd.call('core.bare', type: 'bool')
@note ‘arguments` block audited against git-scm.com/docs/git-config/2.53.0
@see Git::Commands::ConfigOptionSyntax
@see git-scm.com/docs/git-config git-config documentation
@api private
Public Instance Methods
Source
# File lib/git/commands/config_option_syntax/get.rb, line 115 def call(*, **) super end
@overload call(name, value_regex = nil, **options)
Execute the `git config --get` command @param name [String] the config key name to look up @param value_regex [String, nil] (nil) optional regex to filter the value @param options [Hash] command options @option options [Boolean, nil] :global (nil) read from global config (`~/.gitconfig`) @option options [Boolean, nil] :system (nil) read from system config @option options [Boolean, nil] :local (nil) read from repository config (`.git/config`) @option options [Boolean, nil] :worktree (nil) read from worktree config @option options [String] :file (nil) read from the specified file Alias: :f @option options [String] :blob (nil) read from the specified blob @option options [Boolean, nil] :includes (nil) respect include directives in config files (`--includes`) @option options [Boolean, nil] :no_includes (nil) do not respect include directives in config files (`--no-includes`) @option options [String] :type (nil) ensure the value conforms to the given type @option options [Boolean, nil] :show_origin (nil) show the origin of the config value @option options [Boolean, nil] :show_scope (nil) show the scope of the config value @option options [Boolean, nil] :null (nil) terminate values with NUL byte instead of newline Alias: :z @option options [String] :default (nil) default value when the key is not found @return [Git::CommandLine::Result] the result of calling `git config --get` @raise [ArgumentError] if unsupported options are provided @raise [Git::FailedError] if git exits outside the allowed range (exit code > 1) @api public
Calls superclass method
Git::Commands::Base::call