oclif / cli-ux

CLI IO utilities
MIT License
545 stars 44 forks source link

georgettica/make filtering more robust #447

Closed georgettica closed 2 years ago

georgettica commented 2 years ago

feat(filter): make filtering more robust

now filtering uses + and - for seperation so we can:

-name=foo
name=foo-age=bar
name=foo+age=bar

second iteration of #435 resolves #414

georgettica commented 2 years ago

all tests should pass, and more tests can be added to explain the new functionality

georgettica commented 2 years ago

Not passing and I am debugging locally.

Basically solved one issue (had a console output where it shouldn't have been) But the most I am still investigating

georgettica commented 2 years ago

another change I was thinking of is adding more flags to allow better flexibility:

npx ts-node examples/table.ts \
  --negation-seperator='!' \
  --addition-seperators='&' \
  --filter !name=hello&company=bob
georgettica commented 2 years ago

@RodEsp @mattgraham WDYT?

RodEsp commented 2 years ago

Hey @georgettica, sorry for the delayed response. This is another breaking change, it will prevent users from filtering based on values that contain a -. I don't think this improves the filtering ability for the table and it also doesn't make its functionality any more obvious or intuitive.

I think the correct fix for #414 is simply to add documentation or allow for using != as an operator. Anything that adds breaking changes is likely not going to get merged anytime soon.

georgettica commented 2 years ago

It's sad but ok. It can also be done via using alternative seperators, this way we can change the seperator if it breaks something for you

I'll create a third PR with just doc changes