2020-06-16 15:22:41 +00:00
|
|
|
import
|
|
|
|
options
|
|
|
|
|
2018-11-21 13:25:53 +00:00
|
|
|
type
|
|
|
|
ConfigurationError* = object of CatchableError
|
|
|
|
|
2019-03-18 02:01:07 +00:00
|
|
|
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
|
|
|
|
|
2020-06-16 15:22:41 +00:00
|
|
|
RestOfCmdLine* = distinct string
|
|
|
|
SubCommandArgs* = distinct string
|
|
|
|
|
|
|
|
Flag* = object
|
|
|
|
name*: TaintedString
|
|
|
|
|
|
|
|
FlagWithValue* = object
|
|
|
|
name*: TaintedString
|
|
|
|
value*: TaintedString
|
|
|
|
|
|
|
|
FlagWithOptionalValue* = object
|
|
|
|
name*: TaintedString
|
|
|
|
value*: Option[TaintedString]
|
|
|
|
|
2019-03-18 02:01:07 +00:00
|
|
|
Unspecified* = object
|
|
|
|
Txt* = object
|
|
|
|
|
2020-06-02 14:38:07 +00:00
|
|
|
SomeDistinctString = InputFile|InputDir|OutPath|OutDir|OutFile
|
|
|
|
|
2019-03-18 02:01:07 +00:00
|
|
|
template `/`*(dir: InputDir|OutDir, path: string): auto =
|
|
|
|
string(dir) / path
|
|
|
|
|
2020-06-02 14:38:07 +00:00
|
|
|
template `$`*(x: SomeDistinctString): string =
|
|
|
|
string(x)
|
|
|
|
|
2018-11-21 13:25:53 +00:00
|
|
|
template desc*(v: string) {.pragma.}
|
2019-11-11 14:42:08 +00:00
|
|
|
template name*(v: string) {.pragma.}
|
|
|
|
template abbr*(v: string) {.pragma.}
|
2021-09-02 08:12:38 +00:00
|
|
|
template separator*(v: string) {.pragma.}
|
2018-11-21 13:25:53 +00:00
|
|
|
template defaultValue*(v: untyped) {.pragma.}
|
2021-05-16 18:42:12 +00:00
|
|
|
template defaultValueDesc*(v: string) {.pragma.}
|
2018-12-19 10:52:32 +00:00
|
|
|
template required* {.pragma.}
|
|
|
|
template command* {.pragma.}
|
|
|
|
template argument* {.pragma.}
|
2020-07-02 15:27:50 +00:00
|
|
|
template hidden* {.pragma.}
|
2020-06-16 15:22:41 +00:00
|
|
|
template inlineConfiguration* {.pragma.}
|
2018-11-21 13:25:53 +00:00
|
|
|
|
2019-08-23 15:52:32 +00:00
|
|
|
template implicitlySelectable* {.pragma.}
|
|
|
|
## This can be applied to a case object discriminator
|
|
|
|
## to allow the value of the discriminator to be determined
|
|
|
|
## implicitly when the user specifies any of the sub-options
|
|
|
|
## that depend on the disciminator value.
|
|
|
|
|