From 952f9f71d46d14dc514787e95e362542f4a969be Mon Sep 17 00:00:00 2001 From: Woonki Moon Date: Fri, 4 Aug 2023 17:24:05 +0900 Subject: [PATCH] fix parsing arguments with comma --- command/command.go | 2 +- lib/parse.go | 4 ++++ test/CheckIfExists.graphql | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/command/command.go b/command/command.go index 3daed34..27d2bbc 100644 --- a/command/command.go +++ b/command/command.go @@ -32,7 +32,7 @@ func (c *Command) Check() error { NotEnoughArgs: "❌ Not enough arguments", OutputFileNeeded: "❌ Output file argument is needed", WrongOption: "❌ Wrong options", - Version: "v0.2.6", + Version: "v0.2.7", } help := flag.Bool("h", false, "show the help") diff --git a/lib/parse.go b/lib/parse.go index dc3f09a..3e6b5b3 100644 --- a/lib/parse.go +++ b/lib/parse.go @@ -820,6 +820,10 @@ func ParseArgument(l *Lexer) []*Arg { } args = append(args, &arg) + + if l.Peek() == ',' { + l.ConsumeToken(',') + } } l.ConsumeToken(')') } diff --git a/test/CheckIfExists.graphql b/test/CheckIfExists.graphql index 9a382a6..76e89be 100644 --- a/test/CheckIfExists.graphql +++ b/test/CheckIfExists.graphql @@ -1,5 +1,5 @@ type Query { - checkIfExists(userId: ID!): CheckIfExistsResponse! + checkIfExists(userId: ID!, name: String): CheckIfExistsResponse! } type CheckIfExistsResponse {