diff options
author | Araq <rumpf_a@web.de> | 2013-02-22 00:48:24 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-02-22 00:48:24 +0100 |
commit | d1d20e5760d66cace75c8a413376d2de5c944f4e (patch) | |
tree | 0e47a50a95a97c39ba8d47cfb0256698c3fee097 /compiler | |
parent | 3c8a80eeb2fd09481315514fda7ba85f417ac13d (diff) | |
parent | f1d5e8479b479cb58fd8bec5fffee84bb66af6dc (diff) | |
download | Nim-d1d20e5760d66cace75c8a413376d2de5c944f4e.tar.gz |
Merge branch 'master' of github.com:Araq/Nimrod
Diffstat (limited to 'compiler')
-rwxr-xr-x | compiler/commands.nim | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/commands.nim b/compiler/commands.nim index 1da632858..4dcf011f4 100755 --- a/compiler/commands.nim +++ b/compiler/commands.nim @@ -65,8 +65,13 @@ proc writeCommandLineUsage() = MsgWriteln(getCommandLineDesc()) helpWritten = true +proc addPrefix(switch: string): string = + if len(switch) == 1: result = "-" & switch + else: result = "--" & switch + proc InvalidCmdLineOption(pass: TCmdLinePass, switch: string, info: TLineInfo) = - LocalError(info, errInvalidCmdLineOption, switch) + if switch == " ": LocalError(info, errInvalidCmdLineOption, "-") + else: LocalError(info, errInvalidCmdLineOption, addPrefix(switch)) proc splitSwitch(switch: string, cmd, arg: var string, pass: TCmdLinePass, info: TLineInfo) = @@ -98,10 +103,10 @@ proc ProcessOnOffSwitchG(op: TGlobalOptions, arg: string, pass: TCmdlinePass, else: LocalError(info, errOnOrOffExpectedButXFound, arg) proc ExpectArg(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = - if arg == "": LocalError(info, errCmdLineArgExpected, switch) + if arg == "": LocalError(info, errCmdLineArgExpected, addPrefix(switch)) proc ExpectNoArg(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) = - if arg != "": LocalError(info, errCmdLineNoArgExpected, switch) + if arg != "": LocalError(info, errCmdLineNoArgExpected, addPrefix(switch)) proc ProcessSpecificNote(arg: string, state: TSpecialWord, pass: TCmdlinePass, info: TLineInfo) = |