Skip to content

Commit 8f0dacb

Browse files
committed
fix call in nim macros
Signed-off-by: George Lemon <[email protected]>
1 parent 698e5a3 commit 8f0dacb

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

src/kapsis/app.nim

+15-15
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
# Made by Humans from OpenPeeps
66
# https://github.com/openpeeps/kapsis
77

8-
import std/[macros, macrocache, os, times, tables,
9-
strutils, sequtils, parseopt, json, oids, enumutils,
10-
uri]
8+
import std/[macros, os, times, tables,
9+
strutils, sequtils, parseopt, json,
10+
oids, enumutils, uri]
1111

1212
import pkg/[voodoo, jsony, checksums/md5]
1313

@@ -673,30 +673,30 @@ macro commands*(registeredCommands: untyped, extras: untyped = nil) =
673673
Kapsis.mainCommand = Kapsis.commands[`kapsisSettings`.mainCommandId]
674674
var
675675
p = quoteShellCommand(commandLineParams()).initOptParser
676-
id: KapsisInput
676+
kapsisCommandId: KapsisInput
677677
input = p.getopt.toSeq()
678678
defaultCommand = Kapsis.mainCommand != nil
679679
if input.len == 0:
680680
printUsage()
681681
QuitSuccess.quit
682682
if Kapsis.commands.hasKey(input[0].key) == false and defaultCommand:
683-
id = (cmdArgument, Kapsis.mainCommand.id, "")
683+
kapsisCommandId = (cmdArgument, Kapsis.mainCommand.id, "")
684684
else:
685-
id = input[0]
686-
input.delete(0)
685+
kapsisCommandId = input[0]
686+
sequtils.delete(input, 0, 0)
687687
var values = ValuesTable()
688-
case id.kind
688+
case kapsisCommandId.kind
689689
of cmdArgument:
690-
if likely(Kapsis.commands.hasKey(id.key)):
691-
let cmd: KapsisCommand = Kapsis.commands[id.key]
690+
if likely(Kapsis.commands.hasKey(kapsisCommandId.key)):
691+
let cmd: KapsisCommand = Kapsis.commands[kapsisCommandId.key]
692692
var i = 0
693693
var flagpos: seq[int]
694694
while i <= input.high:
695695
case input[i].kind
696696
of cmdLongOption, cmdShortOption:
697697
if input[i].key in ["help", "h"]:
698698
# print helpers of a specific command
699-
printUsage(showExtras=false, showCommand=id.key)
699+
printUsage(showExtras=false, showCommand=kapsisCommandId.key)
700700
QuitSuccess.quit
701701
else:
702702
let key = prefix(input[i].key, input[i].kind)
@@ -721,7 +721,7 @@ macro commands*(registeredCommands: untyped, extras: untyped = nil) =
721721
# input.delete(x) # delete flags
722722
for i in 0..index.high:
723723
if i in flagpos:
724-
echo "flag"
724+
#echo "flag"
725725
continue
726726
if index[i][0] in {cmdLongOption, cmdShortOption}:
727727
continue # already collected, skipping flags
@@ -749,16 +749,16 @@ macro commands*(registeredCommands: untyped, extras: untyped = nil) =
749749
# instead, will list the available subcommands.
750750
printUsage(false, cmd.idDir, true)
751751
else: discard
752-
else: printError(unknownCommand, id.key)
752+
else: printError(unknownCommand, kapsisCommandId.key)
753753
of cmdLongOption, cmdShortOption:
754754
# print usage including argument types.
755755
# -v/--version prints the current version
756756
# of the application that is automatically
757757
# retrieved from your .nimble file
758-
case id.key
758+
case kapsisCommandId.key
759759
of "help", "h": printUsage(showExtras = true)
760760
of "version", "v": display(Kapsis.pkg.version)
761-
else: printError(unknownOption, id.key)
761+
else: printError(unknownOption, kapsisCommandId.key)
762762
else: discard
763763
add result, blockStmt
764764
# echo result.repr

0 commit comments

Comments
 (0)