App::Sqitch::Command::config - Get and set local, user, or system Sqitch options
my $cmd = App::Sqitch::Command::config->new(\%params); $cmd->execute;
You can query/set/replace/unset Sqitch options with this command. The name is actually the section and the key separated by a dot, and the value will be escaped.
my @opts = App::Sqitch::Command::config->options;
Returns a list of Getopt::Long option specifications for the command-line options for the
my $params = App::Sqitch::Command::config->configure( $config, $options, );
Processes the configuration and command options and returns a hash suitable for the constructor. Exits with an error on option specification errors.
my $config = App::Sqitch::Command::config->new($params);
Creates and returns a new
config command object. The supported parameters include:
The core Sqitch object.
Configuration file to read from and write to.
The action to be executed. May be one of:
If not specified, the action taken by
execute() will depend on the number of arguments passed to it. If only one, the action will be
get. If two or more, the action will be
The configuration file context. Must be one of:
The type to cast a value to be set to or fetched as. May be one of:
If not specified or
undef, no casting will be performed.
These methods are mainly provided as utilities for the command subclasses to use.
Executes the config command. Pass the name of the property and the value to be assigned to it, if applicable.
$config->get($key); $config->get($key, $regex);
Emits the value for the specified key. The optional second argument is a regular expression that the value to be returned must match. Exits with an error if the is more than one value for the specified key, or if the key does not exist.
$config->get_all($key); $config->get_all($key, $regex);
get(), but emits all of the values for the given key, rather then exiting with an error when there is more than one value.
$config->get_regex($key); $config->get_regex($key, $regex);
get_all(), but the first parameter is a regular expression that will be matched against all keys.
$config->set($key, $value); $config->set($key, $value, $regex);
Sets the value for a key. Exits with an error if the key already exists and has multiple values.
Adds a value for a key. If the key already exists, the value will be added as an additional value.
$config->replace_all($key, $value); $config->replace_all($key, $value, $regex);
Replace all matching values.
$config->unset($key); $config->unset($key, $regex);
Unsets a key. If the optional second argument is passed, the key will be unset only if the value matches the regular expression. If the key has multiple values,
unset() will exit with an error.
$config->unset_all($key); $config->unset_all($key, $regex);
unset(), but will not exit with an error if the key has multiple values.
Renames a section. Exits with an error if the section does not exist or if either name is not a valid section name.
Removes a section. Exits with an error if the section does not exist.
Lists all of the values in the configuration. If the context is
system, only the settings set for that context will be emitted. Otherwise, all settings will be listed.
Opens the context-specific configuration file in a text editor for direct editing. If no context is specified, the local config file will be opened. The editor is determined by "editor" in Sqitch.
my $file_name = $config->file;
Returns the path to the configuration file to be acted upon. If the context is
system, then the value returned is
$($etc_prefix)/sqitch.conf. If the context is
user, then the value returned is
~/.sqitch/sqitch.conf. Otherwise, the default is ./sqitch.conf.
Help for the
config command to the Sqitch command-line client.
The Sqitch command-line client.
David E. Wheeler <email@example.com>
Copyright (c) 2012 iovation Inc.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.