implemented --listFullPaths option for aporia
This commit is contained in:
parent
df1e7b8021
commit
3020257559
4 changed files with 16 additions and 3 deletions
|
|
@ -458,6 +458,9 @@ proc processSwitch(switch, arg: string, pass: TCmdlinePass, info: TLineInfo) =
|
||||||
of "stdout":
|
of "stdout":
|
||||||
expectNoArg(switch, arg, pass, info)
|
expectNoArg(switch, arg, pass, info)
|
||||||
incl(gGlobalOptions, optStdout)
|
incl(gGlobalOptions, optStdout)
|
||||||
|
of "listfullpaths":
|
||||||
|
expectNoArg(switch, arg, pass, info)
|
||||||
|
gListFullPaths = true
|
||||||
else:
|
else:
|
||||||
if strutils.find(switch, '.') >= 0: options.setConfigVar(switch, arg)
|
if strutils.find(switch, '.') >= 0: options.setConfigVar(switch, arg)
|
||||||
else: InvalidCmdLineOption(pass, switch, info)
|
else: InvalidCmdLineOption(pass, switch, info)
|
||||||
|
|
|
||||||
|
|
@ -532,6 +532,14 @@ proc toFullPath*(info: TLineInfo): string =
|
||||||
if info.fileIndex < 0: result = "???"
|
if info.fileIndex < 0: result = "???"
|
||||||
else: result = fileInfos[info.fileIndex].fullPath
|
else: result = fileInfos[info.fileIndex].fullPath
|
||||||
|
|
||||||
|
proc ToMsgFilename*(info: TLineInfo): string =
|
||||||
|
if info.fileIndex < 0: result = "???"
|
||||||
|
else:
|
||||||
|
if gListFullPaths:
|
||||||
|
result = fileInfos[info.fileIndex].fullPath
|
||||||
|
else:
|
||||||
|
result = fileInfos[info.fileIndex].projPath
|
||||||
|
|
||||||
proc ToLinenumber*(info: TLineInfo): int {.inline.} =
|
proc ToLinenumber*(info: TLineInfo): int {.inline.} =
|
||||||
result = info.line
|
result = info.line
|
||||||
|
|
||||||
|
|
@ -622,7 +630,7 @@ proc writeContext(lastinfo: TLineInfo) =
|
||||||
var info = lastInfo
|
var info = lastInfo
|
||||||
for i in countup(0, len(msgContext) - 1):
|
for i in countup(0, len(msgContext) - 1):
|
||||||
if msgContext[i] != lastInfo and msgContext[i] != info:
|
if msgContext[i] != lastInfo and msgContext[i] != info:
|
||||||
MsgWriteln(posContextFormat % [toFilename(msgContext[i]),
|
MsgWriteln(posContextFormat % [toMsgFilename(msgContext[i]),
|
||||||
coordToStr(msgContext[i].line),
|
coordToStr(msgContext[i].line),
|
||||||
coordToStr(msgContext[i].col),
|
coordToStr(msgContext[i].col),
|
||||||
getMessageStr(errInstantiationFrom, "")])
|
getMessageStr(errInstantiationFrom, "")])
|
||||||
|
|
@ -676,7 +684,7 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string,
|
||||||
ignoreMsg = optHints notin gOptions or msg notin gNotes
|
ignoreMsg = optHints notin gOptions or msg notin gNotes
|
||||||
frmt = posHintFormat
|
frmt = posHintFormat
|
||||||
inc(gHintCounter)
|
inc(gHintCounter)
|
||||||
let s = frmt % [toFilename(info), coordToStr(info.line),
|
let s = frmt % [toMsgFilename(info), coordToStr(info.line),
|
||||||
coordToStr(info.col), getMessageStr(msg, arg)]
|
coordToStr(info.col), getMessageStr(msg, arg)]
|
||||||
if not ignoreMsg:
|
if not ignoreMsg:
|
||||||
MsgWriteln(s)
|
MsgWriteln(s)
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,7 @@ var
|
||||||
gNumberOfProcessors*: int # number of processors
|
gNumberOfProcessors*: int # number of processors
|
||||||
|
|
||||||
gWholeProject*: bool # for 'doc2': output any dependency
|
gWholeProject*: bool # for 'doc2': output any dependency
|
||||||
|
gListFullPaths*: bool
|
||||||
|
|
||||||
const
|
const
|
||||||
genSubDir* = "nimcache"
|
genSubDir* = "nimcache"
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ Advanced options:
|
||||||
-m, --mainmodule:FILE set the project main module
|
-m, --mainmodule:FILE set the project main module
|
||||||
-o, --out:FILE set the output filename
|
-o, --out:FILE set the output filename
|
||||||
--stdout output to stdout
|
--stdout output to stdout
|
||||||
|
--listFullPaths list full paths in messages
|
||||||
-w, --warnings:on|off turn all warnings on|off
|
-w, --warnings:on|off turn all warnings on|off
|
||||||
--warning[X]:on|off turn specific warning X on|off
|
--warning[X]:on|off turn specific warning X on|off
|
||||||
--hints:on|off turn all hints on|off
|
--hints:on|off turn all hints on|off
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue