firebase / firebase/firebase-tools

Value passed to equal-to parsed as an option if it contains "-"

Open
#1,925 1 comment 0 reactions 0 assignees View on GitHub
api: database type: bug
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

### [REQUIRED] Environment info

**firebase-tools:** `7.12.0`

**Platform:** MacOS

### [REQUIRED] Test case

Run `database:get` with `equal-to` which contains a `-`:

```
firebase database:get /some --order-by someKey --equal-to -TEST-gX7Do9x8jyqAJD
```

Even if wrapping value in string, the error still appears:

```
firebase database:get /some --order-by someKey --equal-to "-TEST-gX7Do9x8jyqAJD"
```

NOTE:

Adding `\\` (i.e. de-limiting) does help:

```
firebase database:get /some --order-by someKey --equal-to \\-TEST-gX7Do9x8jyqAJD
```

That said, wrapping in a string should mean that input is correctly parsed. This behavior is also not something I saw documented anywhere. Either way, the hope is that a more clear error message would be shown

### [REQUIRED] Steps to reproduce

1. Have a path in the database at path `/some` which contains objects with the parameter "someKey"
### [REQUIRED] Expected behavior

It is expected that the value passed to the command is correctly parsed, even if it contains `-`. A more clear error message would also work

### [REQUIRED] Actual behavior

```
[2020-01-16T23:50:51.986Z] ----------------------------------------------------------------------
[2020-01-16T23:50:51.989Z] Command: /Users/scott/.nvm/versions/node/v10.15.3/bin/node /projectpath/node_modules/.bin/firebase database:get /some --order-by someKey --equal-to -TEST-gX7Do9x8jyqAJD --debug
[2020-01-16T23:50:51.989Z] CLI Version: 7.12.0
[2020-01-16T23:50:51.989Z] Platform: darwin
[2020-01-16T23:50:51.990Z] Node Version: v10.15.3
[2020-01-16T23:50:51.990Z] Time: Thu Jan 16 2020 15:50:51 GMT-0800 (Pacific Standard Time)
[2020-01-16T23:50:51.991Z] ----------------------------------------------------------------------
[2020-01-16T23:50:51.991Z]
error: unknown option '-E'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.