mirror of
https://github.com/apple/pkl.git
synced 2026-01-11 22:30:54 +01:00
Change CLI flag and Gradle name for proxy options (#526)
Rationale: "proxy" can mean very different things (e.g. java.lang.reflect.Proxy in Java). This makes the flag name more specific. CLI: * `--proxy` -> `--http-proxy` * `--no-proxy` -> `--http-no-proxy` Gradle: * `proxyAddress` -> `httpProxy` * `noProxy` -> `httpNoProxy`
This commit is contained in:
@@ -130,10 +130,10 @@ data class CliBaseOptions(
|
||||
val caCertificates: List<Path> = listOf(),
|
||||
|
||||
/** The proxy to connect to. */
|
||||
val proxyAddress: URI? = null,
|
||||
val httpProxy: URI? = null,
|
||||
|
||||
/** Hostnames, IP addresses, or CIDR blocks to not proxy. */
|
||||
val noProxy: List<String>? = null,
|
||||
val httpNoProxy: List<String>? = null,
|
||||
) {
|
||||
|
||||
companion object {
|
||||
|
||||
@@ -160,12 +160,12 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) {
|
||||
}
|
||||
|
||||
private val proxyAddress by lazy {
|
||||
cliOptions.proxyAddress
|
||||
cliOptions.httpProxy
|
||||
?: project?.evaluatorSettings?.http?.proxy?.address ?: settings.http?.proxy?.address
|
||||
}
|
||||
|
||||
private val noProxy by lazy {
|
||||
cliOptions.noProxy
|
||||
cliOptions.httpNoProxy
|
||||
?: project?.evaluatorSettings?.http?.proxy?.noProxy ?: settings.http?.proxy?.noProxy
|
||||
}
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ class BaseOptions : OptionGroup() {
|
||||
@Suppress("HttpUrlsUsage")
|
||||
val proxy: URI? by
|
||||
option(
|
||||
names = arrayOf("--proxy"),
|
||||
names = arrayOf("--http-proxy"),
|
||||
metavar = "<address>",
|
||||
help = "Proxy to use for HTTP(S) connections."
|
||||
)
|
||||
@@ -191,7 +191,7 @@ class BaseOptions : OptionGroup() {
|
||||
|
||||
val noProxy: List<String>? by
|
||||
option(
|
||||
names = arrayOf("--no-proxy"),
|
||||
names = arrayOf("--http-no-proxy"),
|
||||
metavar = "<pattern1,pattern2>",
|
||||
help = "Hostnames that should not be connected to via a proxy."
|
||||
)
|
||||
@@ -229,8 +229,8 @@ class BaseOptions : OptionGroup() {
|
||||
omitProjectSettings = projectOptions?.omitProjectSettings ?: false,
|
||||
noProject = projectOptions?.noProject ?: false,
|
||||
caCertificates = caCertificates,
|
||||
proxyAddress = proxy,
|
||||
noProxy = noProxy ?: emptyList()
|
||||
httpProxy = proxy,
|
||||
httpNoProxy = noProxy ?: emptyList()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user