aboutsummaryrefslogtreecommitdiff
path: root/src/pacman.nim
diff options
context:
space:
mode:
authorkitsunyan2018-06-09 19:26:16 +0000
committerkitsunyan2018-06-09 19:26:16 +0000
commit0b6c3e6732c5c0d5b6613d2fe450c3b7760c0827 (patch)
tree72fac7f0d47d7ef1683bc2be639fb3cea524ee17 /src/pacman.nim
parent56e82963b465116af32231aa531e8f6344826eab (diff)
Add support for "--disable-download-timeout" option
Diffstat (limited to 'src/pacman.nim')
-rw-r--r--src/pacman.nim8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/pacman.nim b/src/pacman.nim
index 7303eec..79ffe53 100644
--- a/src/pacman.nim
+++ b/src/pacman.nim
@@ -79,6 +79,7 @@ const
^o("color"),
^o("config"),
o("debug"),
+ o("disable-download-timeout"),
^o("gpgdir"),
^o("hookdir"),
^o("logfile"),
@@ -299,6 +300,7 @@ proc createConfigFromTable(table: Table[string, string], dbs: seq[string]): Pacm
let gpgRel = table.opt("GPGDir")
let color = if table.hasKey("Color"): ColorMode.colorAuto else: ColorMode.colorNever
let verbosePkgList = table.hasKey("VerbosePkgLists")
+ let downloadTimeout = not table.hasKey("DisableDownloadTimeout")
let arch = table.opt("Architecture").get("auto")
let ignorePkgs = table.opt("IgnorePkg").get("").splitWhitespace.toSet
let ignoreGroups = table.opt("IgnoreGroup").get("").splitWhitespace.toSet
@@ -311,8 +313,8 @@ proc createConfigFromTable(table: Table[string, string], dbs: seq[string]): Pacm
PacmanConfig(sysrootOption: none(string), rootRelOption: rootRel,
dbRelOption: dbRel, cacheRelOption: cacheRel, gpgRelOption: gpgRel,
dbs: dbs, arch: archFinal, colorMode: color, debug: false, progressBar: true,
- verbosePkgList: verbosePkgList, pgpKeyserver: none(string), defaultRoot: true,
- ignorePkgs: ignorePkgs, ignoreGroups: ignoreGroups)
+ verbosePkgList: verbosePkgList, downloadTimeout: downloadTimeout, pgpKeyserver: none(string),
+ defaultRoot: true, ignorePkgs: ignorePkgs, ignoreGroups: ignoreGroups)
proc obtainPacmanConfig*(args: seq[Argument]): PacmanConfig =
proc getAll(pair: OptionPair): seq[string] =
@@ -336,6 +338,7 @@ proc obtainPacmanConfig*(args: seq[Argument]): PacmanConfig =
let colors = toSeq(enumerate[ColorMode]())
colors.filter(c => $c == color).optLast.get(ColorMode.colorNever)
+ let downloadTimeout = not args.check(%%%"disable-download-timeout")
let rootRel = getAll(%%%"root").optLast.orElse(defaultConfig.rootRelOption)
let dbRel = getAll(%%%"dbpath").optLast.orElse(defaultConfig.dbRelOption)
let cacheRel = getAll(%%%"cachedir").optLast.orElse(defaultConfig.cacheRelOption)
@@ -389,6 +392,7 @@ proc obtainPacmanConfig*(args: seq[Argument]): PacmanConfig =
dbRelOption: dbRel, cacheRelOption: cacheRel, gpgRelOption: gpgRel,
dbs: defaultConfig.dbs, arch: arch, colorMode: color, debug: debug,
progressBar: progressBar, verbosePkgList: defaultConfig.verbosePkgList,
+ downloadTimeout: defaultConfig.downloadTimeout and downloadTimeout,
pgpKeyserver: pgpKeyserver, defaultRoot: defaultRoot,
ignorePkgs: ignorePkgs + defaultConfig.ignorePkgs,
ignoreGroups: ignoreGroups + defaultConfig.ignoreGroups)