Implement --noColor option.
This commit is contained in:
parent
c1ffe62a68
commit
d9f2e6c49e
2 changed files with 21 additions and 5 deletions
|
|
@ -20,6 +20,7 @@ type
|
|||
pkgInfoCache*: TableRef[string, PackageInfo]
|
||||
showHelp*: bool
|
||||
showVersion*: bool
|
||||
noColor*: bool
|
||||
|
||||
ActionType* = enum
|
||||
actionNil, actionRefresh, actionInit, actionDump, actionPublish,
|
||||
|
|
@ -92,6 +93,7 @@ Options:
|
|||
--nimbleDir:dirname Set the Nimble directory.
|
||||
--verbose Show all non-debug output.
|
||||
--debug Show all output including debug messages.
|
||||
--noColor Don't colorise output.
|
||||
|
||||
For more information read the Github readme:
|
||||
https://github.com/nim-lang/nimble#readme
|
||||
|
|
@ -249,6 +251,7 @@ proc parseFlag*(flag, val: string, result: var Options, kind = cmdLongOption) =
|
|||
of "nimbledir": result.nimbleDir = val
|
||||
of "verbose": result.verbosity = LowPriority
|
||||
of "debug": result.verbosity = DebugPriority
|
||||
of "nocolor": result.noColor = true
|
||||
# Action-specific flags.
|
||||
else:
|
||||
case result.action.typ
|
||||
|
|
@ -318,6 +321,9 @@ proc parseCmdLine*(): Options =
|
|||
# Set verbosity level.
|
||||
setVerbosity(result.verbosity)
|
||||
|
||||
# Set whether color should be shown.
|
||||
setShowColor(not result.noColor)
|
||||
|
||||
# Parse config.
|
||||
result.config = parseConfig()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue