Turn execExternalProgram msgs into hintExecuting

Or hintLinking that is used on verbosity:1. This lets you treat this message as
regular hint, and control it via command line.
This commit is contained in:
Adam Strzelecki
2015-06-06 11:17:50 +02:00
parent 592f867aa5
commit 18b3d04291
2 changed files with 13 additions and 14 deletions

View File

@@ -438,16 +438,12 @@ proc addFileToLink*(filename: string) =
prependStr(toLink, filename)
# BUGFIX: was ``appendStr``
proc execWithEcho(cmd: string, prettyCmd = ""): int =
if optListCmd in gGlobalOptions or gVerbosity > 0:
if prettyCmd != "":
msgWriteln(prettyCmd)
else:
msgWriteln(cmd)
proc execWithEcho(cmd: string, msg = hintExecuting): int =
rawMessage(msg, cmd)
result = execCmd(cmd)
proc execExternalProgram*(cmd: string, prettyCmd = "") =
if execWithEcho(cmd, prettyCmd) != 0:
proc execExternalProgram*(cmd: string, msg = hintExecuting) =
if execWithEcho(cmd, msg) != 0:
rawMessage(errExecutionOfProgramFailed, "")
proc generateScript(projectFile: string, script: Rope) =
@@ -703,10 +699,8 @@ proc callCCompiler*(projectfile: string) =
"nim", quoteShell(getPrefixDir()),
"lib", quoteShell(libpath)])
if optCompileOnly notin gGlobalOptions:
if gVerbosity == 1:
execExternalProgram(linkCmd, "[Linking]")
else:
execExternalProgram(linkCmd)
execExternalProgram(linkCmd,
if gVerbosity > 1: hintExecuting else: hintLinking)
else:
linkCmd = ""
if optGenScript in gGlobalOptions:

View File

@@ -126,6 +126,7 @@ type
hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled,
hintProcessing, hintCodeBegin, hintCodeEnd, hintConf, hintPath,
hintConditionAlwaysTrue, hintName, hintPattern,
hintExecuting, hintLinking,
hintUser
const
@@ -416,6 +417,8 @@ const
hintConditionAlwaysTrue: "condition is always true: '$1'",
hintName: "name should be: '$1'",
hintPattern: "$1",
hintExecuting: "$1",
hintLinking: "",
hintUser: "$1"]
const
@@ -431,10 +434,10 @@ const
"ProveInit", "ProveField", "ProveIndex", "GcUnsafe", "GcUnsafe2", "Uninit",
"GcMem", "Destructor", "LockLevel", "ResultShadowed", "User"]
HintsToStr*: array[0..16, string] = ["Success", "SuccessX", "LineTooLong",
HintsToStr*: array[0..18, string] = ["Success", "SuccessX", "LineTooLong",
"XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded",
"ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf",
"Path", "CondTrue", "Name", "Pattern",
"Path", "CondTrue", "Name", "Pattern", "Exec", "Link",
"User"]
const
@@ -492,10 +495,12 @@ const
warnGcUnsafe,
hintSuccessX, hintPath, hintConf,
hintProcessing,
hintExecuting, hintLinking,
hintCodeBegin, hintCodeEnd},
{low(TNoteKind)..high(TNoteKind)} - {warnShadowIdent, warnUninit,
warnProveField, warnProveIndex,
warnGcUnsafe,
hintExecuting,
hintCodeBegin, hintCodeEnd},
{low(TNoteKind)..high(TNoteKind)},
{low(TNoteKind)..high(TNoteKind)}]