diff options
author | kitsunyan | 2018-05-20 11:07:35 +0000 |
---|---|---|
committer | kitsunyan | 2018-05-20 11:07:35 +0000 |
commit | 80b7087c8f8995cbadd038661b0dcdd39c7d08d5 (patch) | |
tree | 85e1f3d2a419ff6f5ff1b9a2c9a592d453e0d25d /src/config.nim | |
parent | 396e9f44c4f5a79c7b9238835599387f6ff418fe (diff) |
Allow to preserve built packages to user cache dir
Preserving is disabled by default now.
Diffstat (limited to 'src/config.nim')
-rw-r--r-- | src/config.nim | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/config.nim b/src/config.nim index b4b9c9a..f0c8710 100644 --- a/src/config.nim +++ b/src/config.nim @@ -1,5 +1,5 @@ import - future, options, posix, re, sets, strutils, tables, + future, options, posix, re, sequtils, sets, strutils, tables, utils type @@ -8,6 +8,11 @@ type colorAuto = "auto", colorAlways = "always" + PreserveBuilt* {.pure.} = enum + internal = "Internal", + user = "User", + disabled = "Disabled" + CommonConfig* = object of RootObj dbs*: seq[string] arch*: string @@ -39,6 +44,7 @@ type printAurNotFound*: bool sudoExec*: bool viewNoDefault*: bool + preserveBuilt*: PreserveBuilt preBuildCommand*: Option[string] proc readConfigFile*(configFile: string): @@ -144,6 +150,9 @@ proc obtainConfig*(config: PacmanConfig): Config = let printAurNotFound = options.hasKey("PrintAurNotFound") let sudoExec = options.hasKey("SudoExec") let viewNoDefault = options.hasKey("ViewNoDefault") + let preserveBuilt = toSeq(enumerate[PreserveBuilt]()) + .filter(o => some($o) == options.opt("PreserveBuilt")) + .optLast.get(PreserveBuilt.disabled) let preBuildCommand = options.opt("PreBuildCommand") Config(root: root, db: db, cache: cache, @@ -153,4 +162,5 @@ proc obtainConfig*(config: PacmanConfig): Config = verbosePkgList: config.verbosePkgList, pgpKeyserver: config.pgpKeyserver, ignorePkgs: config.ignorePkgs, ignoreGroups: config.ignoreGroups, aurComments: aurComments, checkIgnored: checkIgnored, printAurNotFound: printAurNotFound, - sudoExec: sudoExec, viewNoDefault: viewNoDefault, preBuildCommand: preBuildCommand) + sudoExec: sudoExec, viewNoDefault: viewNoDefault, preserveBuilt: preserveBuilt, + preBuildCommand: preBuildCommand) |