Skip to content

Commit

Permalink
(chocolatey#2377) Add new config value DefaultTemplateName
Browse files Browse the repository at this point in the history
This will be used to allow the user to control which template should be
used by default. While it is possible to allow the user to override the
default template files, this gives them a little bit more control, to
specify via configuration which template they want to use by default.
  • Loading branch information
gep13 committed Oct 3, 2021
1 parent 13f224b commit ff01e61
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/chocolatey/infrastructure.app/ApplicationParameters.cs
Expand Up @@ -174,6 +174,7 @@ public static class ConfigSettings
public static readonly string ProxyBypassOnLocal = "proxyBypassOnLocal";
public static readonly string WebRequestTimeoutSeconds = "webRequestTimeoutSeconds";
public static readonly string UpgradeAllExceptions = "upgradeAllExceptions";
public static readonly string DefaultTemplateName = "defaultTemplateName";
}

public static class Features
Expand Down
Expand Up @@ -254,6 +254,7 @@ private static void set_config_items(ChocolateyConfiguration config, ConfigFileS
config.Proxy.BypassList = set_config_item(ApplicationParameters.ConfigSettings.ProxyBypassList, configFileSettings, string.Empty, "Optional proxy bypass list. Comma separated. Available in 0.10.4+.");
config.Proxy.BypassOnLocal = set_config_item(ApplicationParameters.ConfigSettings.ProxyBypassOnLocal, configFileSettings, "true", "Bypass proxy for local connections. Available in 0.10.4+.").is_equal_to(bool.TrueString);
config.UpgradeCommand.PackageNamesToSkip = set_config_item(ApplicationParameters.ConfigSettings.UpgradeAllExceptions, configFileSettings, string.Empty, "A comma-separated list of package names that should not be upgraded when running `choco upgrade all'. Defaults to empty. Available in 0.10.14+.");
config.DefaultTemplateName = set_config_item(ApplicationParameters.ConfigSettings.DefaultTemplateName, configFileSettings, string.Empty, "Default template name used when running 'choco new' command. Available in 0.12.0+.");
}

private static string set_config_item(string configName, ConfigFileSettings configFileSettings, string defaultValue, string description, bool forceSettingValue = false)
Expand Down
Expand Up @@ -146,6 +146,7 @@ private void append_output(StringBuilder propertyValues, string append)
public bool ContainsLegacyPackageInstalls { get; set; }
public int CommandExecutionTimeoutSeconds { get; set; }
public int WebRequestTimeoutSeconds { get; set; }
public string DefaultTemplateName { get; set; }

/// <summary>
/// One or more source locations set by configuration or by command line. Separated by semi-colon
Expand Down

0 comments on commit ff01e61

Please sign in to comment.