mirror of
https://github.com/status-im/nim-confutils.git
synced 2025-01-09 19:55:58 +00:00
bec75f7cec
Also adds support for referencing the config object within the `defaultValue` expressions.
33 lines
851 B
Nim
33 lines
851 B
Nim
import os
|
|
|
|
type
|
|
ConfigurationError* = object of CatchableError
|
|
|
|
TypedInputFile*[ContentType = Unspecified,
|
|
Format = Unspecified,
|
|
defaultExt: static string] = distinct string
|
|
|
|
# InputFile* = TypedInputFile[Unspecified, Unspecified, ""]
|
|
# TODO temporary work-around, see parseCmdArg
|
|
InputFile* = distinct string
|
|
|
|
InputDir* = distinct string
|
|
OutPath* = distinct string
|
|
OutDir* = distinct string
|
|
OutFile* = distinct string
|
|
|
|
Unspecified* = object
|
|
Txt* = object
|
|
|
|
template `/`*(dir: InputDir|OutDir, path: string): auto =
|
|
string(dir) / path
|
|
|
|
template desc*(v: string) {.pragma.}
|
|
template longform*(v: string) {.pragma.}
|
|
template shortform*(v: string) {.pragma.}
|
|
template defaultValue*(v: untyped) {.pragma.}
|
|
template required* {.pragma.}
|
|
template command* {.pragma.}
|
|
template argument* {.pragma.}
|
|
|