Skip to content

Commit

Permalink
gq -v key=val accept '=' in the val (fix hasura#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppdx999 committed May 27, 2023
1 parent 7492019 commit c351937
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/command.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ class GraphqurlCommand extends Command {
if (flags.variable) {
for (let v of flags.variable) {
const parts = v.split('=');
if (parts.length !== 2) {
this.error(`cannot parse variable '${v} (multiple '=')`);
var val = parts.slice(1).join('=').trim();
if (val.length === 0) {
this.error(`cannot parse variable '${v} (no '=' found)`);
}
var val = parts[1].trim();
try {
val = JSON.parse(val);
} catch (err) {
Expand Down

0 comments on commit c351937

Please sign in to comment.