From 39456fa3d5b637053b616e50a8350b2b932a1d4c Mon Sep 17 00:00:00 2001 From: Zahary Karadjov Date: Thu, 2 Jul 2020 18:27:50 +0300 Subject: [PATCH] Hidden configuration fields (initial faux version) --- confutils.nim | 6 ++++++ confutils/defs.nim | 1 + 2 files changed, 7 insertions(+) diff --git a/confutils.nim b/confutils.nim index 17862e7..1a99308 100644 --- a/confutils.nim +++ b/confutils.nim @@ -588,6 +588,9 @@ proc generateFieldSetters(RecordType: NimNode): NimNode = var settersArray = newTree(nnkBracket) for field in recordFields(recordDef): + if field.readPragma("hidden") != nil: + continue + var setterName = ident($field.name & "Setter") fieldName = field.name @@ -649,6 +652,9 @@ proc cmdInfoFromType(T: NimNode): CmdInfo = fieldIdx = 0 for field in recordFields(recordDef): + if field.readPragma("hidden") != nil: + continue + let isImplicitlySelectable = field.readPragma"implicitlySelectable" != nil defaultValue = field.readPragma"defaultValue" diff --git a/confutils/defs.nim b/confutils/defs.nim index 54491d4..514a42e 100644 --- a/confutils/defs.nim +++ b/confutils/defs.nim @@ -49,6 +49,7 @@ template defaultValue*(v: untyped) {.pragma.} template required* {.pragma.} template command* {.pragma.} template argument* {.pragma.} +template hidden* {.pragma.} template inlineConfiguration* {.pragma.} template implicitlySelectable* {.pragma.}