aboutsummaryrefslogtreecommitdiff
path: root/src/config.nim
diff options
context:
space:
mode:
authorkitsunyan2018-05-31 06:56:07 +0000
committerkitsunyan2018-05-31 06:56:07 +0000
commit6220a954ef32fec18258b4feab6494aa016764e0 (patch)
treefc03a22be13a1b46934f9a28bb1522bcc610a3a1 /src/config.nim
parent5b5aa7c3968a4e36763edeb7d50b105a9248b39e (diff)
Simplify alpm initialization
Diffstat (limited to 'src/config.nim')
-rw-r--r--src/config.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/config.nim b/src/config.nim
index f0c8710..2aa9974 100644
--- a/src/config.nim
+++ b/src/config.nim
@@ -164,3 +164,8 @@ proc obtainConfig*(config: PacmanConfig): Config =
aurComments: aurComments, checkIgnored: checkIgnored, printAurNotFound: printAurNotFound,
sudoExec: sudoExec, viewNoDefault: viewNoDefault, preserveBuilt: preserveBuilt,
preBuildCommand: preBuildCommand)
+
+template withAlpmConfig*(config: Config, passDbs: bool,
+ handle: untyped, alpmDbs: untyped, errors: untyped, body: untyped): untyped =
+ withAlpm(config.root, config.db, if passDbs: config.dbs else: @[], config.arch,
+ handle, alpmDbs, errors, body)